I have used the solution below with success. I had gotten this script from a co-worker of mine. It uses JavaScript functions to disable and enable the button. While disable it also sets the button image to a .gif to indicate processing.
Forgive me if this was already posted as a solution on another thread.
function disableBtn(btnID, newText) {
Page_IsValid = null;
if (typeof (Page_ClientValidate) == 'function') {
Page_ClientValidate();
}
var btn = document.getElementById(btnID);
var isValidationOk = Page_IsValid;
if (navigator.appName !== 'Microsoft Internet Explorer')
{
EnableOnUnload(btnID, btn.value);
}
if (isValidationOk !== null) {
if (isValidationOk) {
btn.disabled = true;
btn.value = newText;
btn.style.background = 'url(~/images/ajax-loader.gif)';
}
else {
btn.disabled = false;
}
}
else {
setTimeout("setImage('"+btnID+"')", 10);
btn.disabled = true;
btn.value = newText;
}
}
function setImage(btnID)
{
var btn = document.getElementById(btnID);
btn.style.background = 'url(images/loading.gif)';
}
function EnableOnUnload(btnID, btnText)
{
window.onunload = function()
{
var btn = document.getElementById(btnID);
btn.disabled = false;
btn.value = btnText;
}
}
Include a call to disableBtn OnClientClick with UseSubmitBehaviour set to false.
<asp:button id="btnSubmit" runat="server" onclientclick="disableBtn(this.id, 'Submitting...')" text="Submit" usesubmitbehavior="False" xmlns:asp="#unknown" />