title: Getting a Confirmation Box to appear and get its value in the code behind
body: <p>Here's what I want to do. I have a form that the user fills out (creating sections and subsections) and when they click save, I want to check the database to see if they have named a section the same as one that already exists. If they have, I want to get a confirmation from them to let them know they wil create a duplicate if they proceed. If they click yes, I need to continue, else I need to abort. Here is some psuedocode for what I have so far.</p>
  
  <pre><code> protected void SaveButton_Click(object sender, EventArgs e)
  {
      try
      {
          if (CheckForDuplicates())
          {
              //proceed normally
          }
      }
  }
  
  private bool CheckForDuplicates()
  {
      //check database
  
              if (/*there are duplicates*/)
              {
                  string message = "A duplicate name exists. Would you like to continue?";
                  string scriptString = "&lt;script language='javascript' 
                      type='text/javascript'&gt;" + "return confirm('" + message + "');&lt;/script&gt;";
  
                  ScriptManager.RegisterStartupScript(this, this.GetType(), 
                      "script", scriptString, false);
  
                  //here i would like to return their confirmation
              }
          }
      }
      return true;
  }
  </code></pre>
  
  <p>All help is appreciated and thanks in advance!</p>