title: JavaScript confirm with ASP.NET
body: <p>I am using JavaScript confirm in an ASP.NET program, the confirm window works when I want it to, however I am not sure how to retrieve whether the user clicks 'OK' or 'Cancel'.</p>
  
  <p>This is in the site master:</p>
  
  <pre><code>            &lt;script type="text/javascript"&gt;
  
                      var confirmMsg = document.getElementById('MainContent_confirmMessageHidden');
  
                      if (confirmMsg != null) confirm(confirmMsg.value);
  
              &lt;/script&gt;
  </code></pre>
  
  <p>This is in the aspx.cs file:</p>
  
  <pre><code>    private void Confirm(string msg)
      {
          //Response.Write("&lt;script language = 'javascript'&gt;window.alert('" + msg + "')&lt;/script&gt;");
          confirmMessageHidden.Value = msg;
          confirmMessageHidden.Visible = true;
  
  
      }
  </code></pre>
  
  <p>How can I retrieve the choice of the user?</p>