In this article I will explain how to disable ASP.Net button control before Page PostBack is done or the form is submitted so that user can’t click the button again.
The solution is very simple and can be accomplished easily with JavaScript
To start with I have created a simple ASP.Net Web Page with 2 ASP.Net Buttons on it.
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Clicked" />
<asp:Button ID="Button2" runat="server" Text="Button2" />

Now here’s the short JavaScript snippet that will disable the button as soon as it is clicked so that when PostBack occurs the button cannot be clicked again.
<script type = "text/javascript">
function DisableButton() {
    document.getElementById("<%=Button1.ClientID %>").disabled = true;
window.onbeforeunload = DisableButton;

The above script disables the ASP.Net Button as soon as the page is ready to do a PostBack or the ASP.Net form is submitted.
But in cases you might want to disable all Buttons and Submit Buttons on the page hence for such cases I have created another function which disables all Buttons and Submit buttons whenever there’s a PostBack or form submission
<script type = "text/javascript">
function DisableButtons() {
    var inputs = document.getElementsByTagName("INPUT");
    for (var i in inputs) {
        if (inputs[i].type == "button" || inputs[i].type == "submit") {
            inputs[i].disabled = true;
window.onbeforeunload = DisableButtons;

The advantage of this script is that you can easily place it in your JS file or even your Master page and it will work automatically on all pages.
The below animated Flash describes how it the script works in action.

The above code has been tested in the following browsers

Internet Explorer  FireFox  Chrome  Safari  Opera 

* All browser logos displayed above are property of their respective owners.

You can download the sample source code using the link below.