Tuesday, February 9, 2010

Prevent user from double clicking an ASP.NET button

The snippet below will disable the asp.net standard button control once the user already clicked it.

<asp:button id="btnSubmit" Text="Submit" onclick="btnSubmit_Click" OnClientClick="this.disabled = true; this.value = 'Submitting...';" UseSubmitBehavior="false" />