You can either do this:
cs
//in pageload
//the request is not in postback or async mode
bt1.OnClientClick = "this.disabled = true; " + ClientScript.GetPostBackEventReference(bt1, null) + ";");
Note: you can replace "this.disabled = true" with a js function that will have better handling for disabling the button and maybe display a friendly message as well.
Or this:
http://msdn.microsoft.com/en-us/library/bb383989.aspx
js
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(CheckStatus);
function CheckStatus(sender, arg)
{
var postBackElement = arg.get_postBackElement();
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm.get_isInAsyncPostBack() && postBackElement.id == "btn1") {
arg.set_cancel(true);
//display friendly message, etc
}
}
Note: I modified it so it checks for the button's id. Replace "btn1"
Good luck!!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…