title: Confirm box in asp.net web form application
body: <p>I want to give user warning with confirm message box if they want to save without uploading image.</p>
  
  <p>Code fires when user click on save button</p>
  
  <pre><code>if (string.IsNullOrEmpty(obj.Image)) {
      obj.Image= null;
      //Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", "alert('Please Upload  Image!');", true);
      Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", "confirm('Are you sure you want to save without uploading  images?');", true);
  }
  </code></pre>
  
  <p>Above logic for was for showing confirm box but it doesn't show.</p>
  
  <p>Besides that, how can I trap if user clicked on <code>Yes</code> or <code>No</code> button?</p>
  
  <p>so that i can fire related code accordingly.</p>
  
  <p>Update: </p>
  
  <p>I am able to show confirm box with following code </p>
  
  <pre><code>Page.ClientScript.RegisterStartupScript(this.GetType(), "msgbxConfirm", "confirm('Are you sure?');", true);
  </code></pre>
  
  <p>But i am not sure how i am going to trap the <code>YES</code> or <code>No</code>  event</p>