title: Asp.net Webform Display Alert and redirect
body: <p>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.
  Here is the code i am using</p>
  
  <pre><code>protected void Save(..)
  {   
      // Do save stuff
      DisplayAlert("The changes were saved Successfully");
      Response.Redirect("Default.aspx");
  }
  </code></pre>
  
  <p>This code just redirects without giving the prompt Saved Successfully.</p>
  
  <p>Here is my DisplayAlert Code</p>
  
  <pre><code> protected virtual void DisplayAlert(string message)
      {
          ClientScript.RegisterStartupScript(
                          this.GetType(),
                          Guid.NewGuid().ToString(),
                          string.Format("alert('{0}');", message.Replace("'", @"\'").Replace("\n", "\\n").Replace("\r", "\\r")),
                          true
                      );
      }
  </code></pre>
  
  <p>Can anyone help me find a solution to this?</p>
  
  <p>Thanks</p>