title: Execute server side code after client side confirmation only
body: <p>I have to display a client side confirmation after calculating a complex formula server side. Something like</p>
  
  <pre><code>//Server side
          On ButtonClick(){
              FetchRate(field1,field2,.... fieldn);
              // Show Client side confirmation
              // Execute server side code if confirmed client side 
      }
  </code></pre>
  
  <p>What I have done is created a client side function but my server side code always executes on postback no matter what I select client side</p>
  
  <pre><code>// Server side    
  ScriptManager.RegisterStartupScript(this,this.GetType(), Guid.NewGuid().ToString(), "ConfirmAction('"+ myRate +"');", true);
  //Client side
      function ConfirmAction(myRate) {
              if (confirm('Are you sure?. Rate is exceeding '+ myRate +', proceed ?')) {
                  document.getElementById('hfSaveUpdate').value = 1;
                  return true;
              }
              else
                  return false;
          }
  </code></pre>