Disable Buttons after click
Category: Asp .Net AJAX / Javascript / CSS
When we have forms being submitted that record something to the Database, it is often a good idea to disable the buttons after the first click.
First add the following code to your header. If you are using master pages, this goes in the masterpage.
Then, in your code behind you will need to add an onclick attribute to the buttons you want to disable
CheckoutButton.Attributes.Add("onclick", "javascript:if(submitFlag){return false;}else{submitFlag = true; return true;}");
Note that on the onclick attribute you could also do something like $get('buttonClientId').Enabled = false . If you use master pages be sure you are using the right clientId for the button.
---------------------------------------------------