title: Prevent double clicking asp.net button ASP.NET C#
body: <p>How can I prevent the user from double-clicking a button? I have been searching the internet and nothing works for me in my project.
  Can you give me examples?</p>
  
  <p>I've this and doesn't work</p>
  
  <pre><code> &lt;script type = "text/javascript"&gt;
   function DisableButton() {
    document.getElementById("&lt;%=Button1.ClientID %&gt;").disabled = true;
   }
    window.onbeforeunload = DisableButton;
   &lt;/script&gt;
  </code></pre>