Quick Tip: How to use OnClick and OnClientClick events to Prevent Double Clicking on your ASP.Net Buttons

Quick Tip

While ASP.Net provides an excellent validator set of controls, sometimes you need to “roll your own” so to speak when creating your controls. In addition, if you have some AJAX processing with your buttons behind the scenes (for example, saving a record in a popup window) you run the risk of having “double saves” occurring when the user clicks on the button and nothing happens immediately.

Having struggled with this issue myself lately, it took a little more work than anticipated to get this to work properly. Here’s how you get everything to play nicely together. Continue reading