Tutorial :how can i redirect the page with AJAX?



Question:

I am using Infragistics control in my application. If the user get deleted from my application then i want to redirect that user to not authorize page. for redirection of the page i am using HttpContext method but it's not working. I tried windows.location as well through java script but it's not working as well. Can somebody help me how to redirect page with AJAX?

Thanks for your help in advance.


Solution:1

Are you consuming a button click event (or something similar) in your code behind?

If so Response.Redirect(url) will work as per a non-AJAX request?


Solution:2

If you are using Infragistics webAsyncRefreshPanel then you will need to create a literal control and add it to webAsyncRefreshPanel controls collection. Try below code.

           System.Text.StringBuilder sb = new System.Text.StringBuilder();              sb.Append("<script language='javascript'>");              sb.Append("window.location=notautorizepage.aspx")               sb.Append("</script>");                LiteralControl c = new LiteralControl(sb.ToString());              webAsyncRefreshPanel.Controls.Add(c);   

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »