Web developers wiki ASP.NET Sitecore Sharepoint Kentico by Evident Interactive

Keep asp:button disabled

Modified: 2008/12/17 10:22 by jim - Categorized as: ASP.NET
Sometimes a button on a form starts some code behind that takes a while to execute. To prevent users from clicking it again and again you can disable the button in a simple way (bolded what does the trick):

<asp:Button ID="btnAddFormSave" runat="server" Text="Voeg toe" causesValidation="true" validationgroup="AddForm" 
UseSubmitBehavior="false" OnClientClick="this.disabled = true" 
OnClick="btnAddFormSave_Click" />

 © Evident Interactive BV