Erik Lenaerts

Do, or do not. There is no try. - Yoda

ASP.NET single submit button

Dimitris, a colleague here at MSP, recently create a slick new ASP.NET Server control. The control is in fact a button with one additional behavior; it will disable itself after you've clicked on it. This behavior is very interesting for sites where the posting of the form may only be done once.

Since ASP.NET is based on HTTP, forms can easelily be submitted more than once by the user when they click repeatetly on the submit button. For the webserver, requests will be handled as if they were comming from mulitple browsers.

So, basically the click event handler will be executed multiple times which is bad for a submit button that's placing an order. Hence this little control.

The DisableButton control will -supprisingly - disable itself (using client side javascript code) once it has been clicked. This way, the user can't accidentially submit the same form multiple times.

You can download the Visual Studio 2005 project here.

Release version of the assembly

Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: