Prevent double click

People tend to double click buttons if an app is taking some time to respond, and this could lead to errors or problems with the user request. In this article I will give you a step by step guide on how to prevent double click in ASP.netOverview

You can normally press a button you can make a countless amount of click before post back. This is very tedious is you are making an insert to your data base because is going to insert the same information over and over.

1Getting Started

As you can see in the image above we have a button login to prevent a double click we can make it with JavaScript adding the following code into out asp button:
OnClientClick=”this.disabled = true; this.value = ‘loading…’;” UseSubmitBehavior=”false”



This has to stop the double or multiples clicks, as you can see in the image bellow the button is disable.

3Put you can also add this lines of codes in the script section.

function BeginRequestHandler(sender, args) { var oControl = args.get_postBackElement(); oControl.disabled = true; }


This last method not only prevent that the event click can make the actions programed twice, till is done the post back put also the other event like focus or key press so you have to know went used this method.

This Concludes Prevent double click

Looking for quality Windows Hosting? Look no further than Arvixe Web Hosting!

Happy Hosting!

Rodolfo Hernandez

Tags: , , , , , , , , , , , , | Posted under ASP .NET 2, ASP .NET 3.5, ASP .NET 4.0 | RSS 2.0

Author Spotlight

Rodolfo Hernandez

I like photography and reading books. Currently working for Arvixe as Elgg Community Liaison. Elgg Security Expert Web Security Expert CEO of UDP SW Social Web

Leave a Reply

Your email address will not be published. Required fields are marked *