There is some situation where we want to show alert message and confiration
message before redirecting to another page.
message before redirecting to another page.
Method 1
1
| Response.Write("<script> alert('Your Message.');window.location='TargetpageURL'; </script>"); |
Method 2
1
| ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ScriptKey", "alert('Your Message will go here.');window.location='TargetpageURL'; ", true); |
Method 3
1
| HTMLHelper.jsAlertAndRedirect(this, "This is an alert.", ResolveUrl("~/Default.aspx")); |
Method 4
1
2
3
4
| string strScript = "<script>"+"alert('your message.');"; strScript += "window.location='test.aspx';"; strScript += "</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Startup", strScript); |


0 comments:
Post a Comment
Note: only a member of this blog may post a comment.