Disable ASP.NET button on click (but still postback)


/ Published in: ASP
Save to your folder(s)

this will disable a button after the first click, but will continue to do its original postback. Note: if it has a custom css class, then the button will still appear clickable, with the exception that the text of the button gets the slight disabled look. But in reality, it really is disabled.


Copy this code and paste it in your HTML
  1. <asp:button id="btnID" runat="server" CssClass="button" Text="Save Current Screen Contracts" UseSubmitBehavior="false" OnClientClick="this.disabled=true" />

URL: http://weblogs.asp.net/jeffwids/archive/2009/10/06/how-to-disable-an-asp-net-button-when-clicked.aspx

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.