Site Search:
Sign in | Join | Help
4Penny.net

ASP.NET

Notes, Tricks and Tips on ASP.NET Coding

Disabling a Button when Clicked

To disable a button when it is clicked, add the following to the load event:

btnSave.Attributes.Add("onclick", "this.disabled=true;" + ClientScript.GetPostBackEventReference(btnSave, "").ToString())

This will cause the button to disable via javascript before the postback happens.  This prevents things like credit card transactions from going through more than once.

Comments

No Comments