title: How to stop asp.net button from being double clicked?
body: <p>Ok, let me preface this question with the fact that I have read through about all the articles on this website and tried the majority of these solutions.</p>
  
  <p>I have a button that has a server side event.  This server side event has a (handles btnSave_click).</p>
  
  <p>My first attempt was of course this. :</p>
  
  <pre><code>btnSave.enable = false
  </code></pre>
  
  <p>This was of course not fast enough.</p>
  
  <p>Then I tried this. :</p>
  
  <pre><code>btnSave.Attributes.Add("onclick", "this.disabled=true;");
  </code></pre>
  
  <p>and this. :</p>
  
  <pre><code>btnSave.Attributes.Add("onclick", " this.disabled = true; " + ClientScript.GetPostBackEventReference(btnSave, Nothing) + ";") 
  </code></pre>
  
  <p>This did not work, of course then I tried a bunch of different jquery and javascript via the OnClientClick event.  This did not work either, but from what I could see it was due to the fact that I have that server side event firing also, I wasn't hitting my functions during stepthrough.  As you can see I have spent a ton of time trying to get this to work.  Hoping someone has an idea as to what I am doing incorrectly here.  What I have is a very simple button and codebehind really nothing extravagant.</p>
  
  <p>Here is my button. :</p>
  
  <pre><code>&lt;asp:Button ID="btnSave" runat="server" Width="60px" Text="Save" Enabled="False"&gt;&lt;/asp:Button&gt;
  </code></pre>
  
  <p>Here is the server side event header. :</p>
  
  <pre><code>Private Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
  </code></pre>
  
  <p>Again any ideas are greatly appreciated.  Thanks.</p>