title: Display confirmation messagebox c# in ASP.NET
body: <p>i found these codes while researching but they're not what i really want:</p>
  
  <p><strong>1st solution:</strong> </p>
  
  <pre><code>private void MsgBoxConfirmDelete(string sMessage)
  {
      string msg = "&lt;script language=\"javascript\"&gt;";
      msg += "var conf = confirm('Are you sure you want to delete this image?');";
      msg += "  if(conf == true){ (alert(....));}";
      msg += "&lt;/script&gt;";
      Response.Write(msg);
  }
  </code></pre>
  
  <p><strong>2nd solution:</strong></p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e) 
  { 
      ClientScriptManager CSM = Page.ClientScript; 
      if (!ReturnValue()) 
      { 
          string strconfirm = "&lt;script&gt;if(!window.confirm('Are you sure?')){window.location.href='Default.aspx'}&lt;/script&gt;"; 
          CSM.RegisterClientScriptBlock(this.GetType(), "Confirm", strconfirm, false); 
      } 
  } 
  bool ReturnValue() 
  { 
      return false; 
  }
  </code></pre>
  
  <p>Most of the solutions i've found is "onclientclick/onclick", however what i need is to display a confirmation message while running my method which is kinda "IN BETWEEN". Thus, i needed a IF/ELSE so badly. Anyone knows how to retrieve the result from a confirmation message like these?</p>
  
  <p>For example: </p>
  
  <blockquote>
    <p>Message: Found some duplicates data while reading, are you sure you
    want to continue? Prompt:  YES/NO</p>
  </blockquote>