title: How would one disable an ASP.NET WebForms button when its clicked, and have it be enabled again after postback completes?
body: <p>What I would like to do is be able to disable a button as soon as it pressed, perform an operation, and re-enable the button. Seemed simple enough, but my button doesn't update when I need it to. I tried an update panel, but I'm not sure if I'm using it correctly. Am I doing something wrong? Or is there a better way to achieve this?</p>
  
  <h2>HTML</h2>
  
  <pre><code>&lt;asp:UpdatePanel runat="server" ID="updateSubmitButton"&gt;
      &lt;ContentTemplate&gt;
          &lt;a href="#resultsSet"&gt;&lt;asp:Button ID="btnSearch" CssClass="CrossoverButton" runat="server" Text="Search" OnClick="btnSearch_Click" /&gt;&lt;/a&gt;
      &lt;/ContentTemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <h2>C#</h2>
  
  <pre><code>protected void btnSearch_Click(object sender, EventArgs e)
  {
      btnSearch.Enabled = false;
      updateContent();
  
      // Do a lengthy operation here.
  
      btnSearch.Enabled = true;
  }
  </code></pre>