title: Calling javascript and getting yes no values inside server code
body: <p>I am calling a javascript function to return yes,no values from the user in a button click event inside an update panel. I want to call certain server side functions depending on user action (yes/no). My javascript code is given below</p>
  
  <pre><code>function Confirm() {
          var confirm_value = document.createElement("INPUT");
          confirm_value.type = "hidden";
          confirm_value.name = "confirm_value";
          if (confirm("Do you want to save data?")) {
              confirm_value.value = "Yes";
          } else {
              confirm_value.value = "No";
          }
          document.forms[0].appendChild(confirm_value);
      }
  </code></pre>
  
  <p>I am calling this in my server side button click which is shown below.</p>
  
  <pre><code> if ((Convert.ToInt32(_dsLeaveDetails.Tables[0].Rows[0][0]) == 1) 
              {
  
                  ShowAlert("Leave is already marked for this date");
                  return;
  
              }
              else if ((Convert.ToInt32(_dsAttendanceDetails.Tables[0].Rows[0][0]) &gt;= 1)) 
              {
  
                  ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "Confirm();", true);
                  string confirmValue = Request.Form["confirm_value"];
                  if (confirmValue == "Yes")
                  {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('You clicked YES!');", true);
                  }
                  else
                  {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('You clicked YES!');", true);
                  }
  
  
                  return;
              }
  </code></pre>
  
  <p>The issue is, pop up is showing only after the code is fully executed and because of that user action (yes/no) cannot be processed further.
  Also I cannot call javascript function on clientclick event because immediately I dont require a pop up. Only after checking the dataset dsAttendanceDetails, I need the pop up. Kindly help.</p>