title: How to get the confirm() value with C# code
body: <p>I have a button which needs get the <code>confirm()</code> value to do the database operation. For example: when clicking the button, a message popup to confirm "yes or no", if yes, it will do the deletion operation in database, if no, it will clear the textbox.  How can I get the returned value from Javascript <code>confirm()</code> function.  Please advise. </p>
  
  <pre><code>string jScript;
  
  jScript = "&lt;script&gt; function processConfirm(answer) {if (answer) {return 'Facilitator Deleted';}else {return 'Cancelled';}} var confirmAnswer = confirm('You sure to delete ?');var theAnswer = processConfirm(confirmAnswer);alert(theAnswer);&lt;/script&gt;";    
  ClientScript.RegisterClientScriptBlock(this.GetType(), "keyClientBlock", jScript);         
  /* SqlCommand cmd = new SqlCommand("TrainerFilter", conn);    
  cmd.CommandType = CommandType.StoredProcedure;        
  cmd.Parameters.Add("@EmployeeID", SqlDbType.Int, 50).Value = TextBox1.Text.Trim();        
  cmd.Parameters.Add("@result", SqlDbType.Int, 50).Direction = ParameterDirection.Output;        
  conn.Open();        
  cmd.ExecuteNonQuery();*/
  </code></pre>