title: javascript confirmation dialog box
body: <p>I have a page with a button and when it is clicked, it will execute a long time task asynchronously. I tried to implement validation on that button using javascript and a confirmation dialog box will pop up when it is clicked. But when i clicked on 'Cancel' in the confirmation dialog box, the long time task still will be executed instead of returning false.</p>
  
  <p>Any idea guys? Any help is appreciated!</p>
  
  <p><strong>Code-Behind:</strong></p>
  
  <pre><code>btnPrint.Attributes.Add("onclick", "javascript:submittingID='btnAdd';return validation();")
  
  Public Sub LongTimeTask()
     .......
  End Sub
  </code></pre>
  
  <p><strong>Javascript:</strong></p>
  
  <pre><code>function validation() {
      ....
      confirmPrint()
  }
  
  function confirmPrint() {
          if (confirm("Are you sure you want to print? This process may take up to few minutes.") == true)
              return true;
          else
              return false;
  }
  </code></pre>