title: execute different codes in code behind on confirm ok and cancel using textbox methods and property only
body: <p>This is the script and I want to use it in code behind previously I used clentclick property of button button I want to use this code without using button</p>
  
  <pre><code>&lt;script type = "text/javascript"&gt;
       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);
       }
      &lt;/script&gt;
  &lt;asp:TextBox ID="TextBox1" runat="server"  ontextchanged="TextBox1_TextChanged"&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>what else can I do so that it is achievable for me</p>
  
  <pre><code>protected void TextBox1_TextChanged(object sender, EventArgs e)
      {
         // TextBox1.Attributes.Add("OnClientClick", "Confirm()");
          string confirmValue = Request.Form["confirm_value"];
          if (confirmValue == "Yes")
          {
              //Your logic for OK button
          }
          else
          {
              //Your logic for cancel button
          }
      }
   public void OnConfirm(object sender, EventArgs e)
      {
      }
  </code></pre>