Reputation: 59
m using java srcipt messagebox..
private void MessageBox(string msg)
{
System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label();
lbl.Text = "<script language='javascript'>" + Environment.NewLine + "window.alert('" + msg + "');</script>";
//lbl.Text = "<script>window.alert('" + msg + "');</script>";
Page.Controls.Add(lbl);
}
now i want to reload my page..but if i write response.redirect my messagebox is not display....i write this function in code behind and call it when i need to display messagebox...so, how can i reload my page???????
Upvotes: 0
Views: 838
Reputation: 33551
Like this
lbl.Text = "<script>window.alert('" + msg + "');window.location.replace('yourotherpage.aspx')</script>";
But please don't forget to properly escape the quotes in your "msg" text. Otherwise you may get a broken script code.
Upvotes: 3