Sometimes you need to redirect the user to another page after he clicks on 'OK' button in the javascript alert box.
Just type your complete script and assign it to a string variable.
register it with RegisterStartupScript as follows.
Look at this example :
C# code behind:
string strScript = "<script>";
strScript += "alert('Type your message here');";
strScript += "window.location='TestPage.aspx';";
strScript += "</script>";
this.ClientScript.RegisterStartupScript(this.GetType(), "Startup", strScript);
strScript += "alert('Type your message here');";
strScript += "window.location='TestPage.aspx';";
strScript += "</script>";
this.ClientScript.RegisterStartupScript(this.GetType(), "Startup", strScript);
This code will display an alert box and when 'OK' button is clicked it will redirect to TestPage.aspx page.
3 comments:
Very much helpful...
Thnx for help...
than you
Post a Comment