title: confirm message box
body: <p>I have to show a yes no popup messagebox for a function></p>
  
  <p>This is what i do for an alert popup></p>
  
  <pre><code>  Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "&lt;script&gt;alert('File Updated');&lt;/script&gt;");
  </code></pre>
  
  <p>This is what i want to do in the code behind:</p>
  
  <pre><code>if (ID != 0)
  {
       Page.ClientScript.RegisterStartupScript(this.GetType(), "Confirm", "&lt;script&gt;confirm('are you sure?');&lt;/script&gt;");
  
      if (yes)
      {
          perform function
      }
      else
      {
          return;
      }
  
  }
  </code></pre>
  
  <p>The confirm is not working,,, any suggestions on how to do this 
   thanks</p>
  
  <p>Edit Portion:</p>
  
  <ol>
  <li>Navigate to a page</li>
  <li>Add values to a textbox</li>
  <li>Click "Save" Button to add value to database</li>
  <li>Ask the user if he is sure he want to do it 'are you sure'?,, the confirm pop up</li>
  <li>Now the above confirm box will only happen if the ID is != 0 or else there is no need for a popup.</li>
  <li>if he says yes then add to database and show alert popup that values have been enterd in the DB.</li>
  <li>if NO then just dont add to Db and just return.</li>
  </ol>
  
  <p>so i get the confirm box like this.. but how can i get what is selected</p>
  
  <pre><code>string scriptString = "&lt;script language='JavaScript'&gt; ";
              scriptString += "confirm ('Are you sure you want to Close this period.')";
              scriptString += "&lt;/script&gt;";
              Response.Write(scriptString);
  </code></pre>