Tuesday, 20 March 2012

Show alert message when window page redirected using asp.net c#

How to show alert message when window page redirected / navigated ( Response.Redirect() method ) using asp.net c#: 

This code using the javascript script and its created / called dynamically the  from code behind:

Sample code:
 
string scriptstring = "var res=confirm('Are you sure to redirect ?');if(res==true){window.location.href='pagemane.aspx?str=YES';}";
                    ClientScript.RegisterStartupScript(this.GetType(), "alertscript", scriptstring, true);

No comments:

Post a Comment