Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
684 Points
450 Posts
Apr 30, 2012 10:40 AM|LINK
When i put it in the aspx asp:button OnClientClick="window.location.hash = 'name/city/category'" it's working, but when i tried to put it from codebehind it's not working.
Please advice how should i use window.location.hash from codebehind. I tried:
protected void Button1_Click(object sender, EventArgs e) { ClientScript.RegisterStartupScript(Page.GetType(), "ChangeToHash", "window.location.hash = 'name/city/category';", true); }
I also tried:
protected void Page_Load(object sender, EventArgs e) { if (Request.Form.AllKeys.Contains("Button1")) { //it gets here in button1_click event ClientScript.RegisterStartupScript(Page.GetType(), "ChangeToHash", "window.location.hash = 'name/city/category';", true); } } //nothing in Button1_Click event
Also, can i somehow avoid the "#" sign using the window.location.hash?
Digitborn.co...
Member
684 Points
450 Posts
Re: ToolkitScriptManager.AddHistoryPoint UrlEncode
Apr 30, 2012 10:40 AM|LINK
When i put it in the aspx asp:button OnClientClick="window.location.hash = 'name/city/category'" it's working, but when i tried to put it from codebehind it's not working.
Please advice how should i use window.location.hash from codebehind. I tried:
protected void Button1_Click(object sender, EventArgs e) { ClientScript.RegisterStartupScript(Page.GetType(), "ChangeToHash", "window.location.hash = 'name/city/category';", true); }I also tried:
protected void Page_Load(object sender, EventArgs e) { if (Request.Form.AllKeys.Contains("Button1")) { //it gets here in button1_click event ClientScript.RegisterStartupScript(Page.GetType(), "ChangeToHash", "window.location.hash = 'name/city/category';", true); } } //nothing in Button1_Click eventAlso, can i somehow avoid the "#" sign using the window.location.hash?