by
back

Disable Button on click in ASP.Net

To use an ASP.Net alternative for the Rails disable_with feature on Submit-Buttons, you can use the snippet below.

Use it on every button you want. Make sure to set the needed attributes OnClientClick and UseSubmitBehavior.

The Code in ASP.Net

<asp:Button runat="server" ID="btnSubmit"   OnClientClick="this.disabled = true; this.value = '...please wait';"  UseSubmitBehavior="false" OnClick="btnSubmit_Click"   Text="Buy Now" />

Cheers,
Flo

comments powered by Disqus