I\'m currently stuck. I have a webform with a button that registers or saves a record. What i\'d like to is have it display a javascript alert and then redirect to a page. H
You can't do a Response.Redirect because your javascript alert will never get displayed. Better to have your javascript code actually do a windows.location.href='default.aspx'
to do the redirection after the alert is displayed. Something like this:
protected virtual void DisplayAlert(string message)
{
ClientScript.RegisterStartupScript(
this.GetType(),
Guid.NewGuid().ToString(),
string.Format("alert('{0}');window.location.href = 'default.aspx'",
message.Replace("'", @"\'").Replace("\n", "\\n").Replace("\r", "\\r")),
true);
}