Loading Method on the server:
Copy codeThe Code is as follows:
Private void OnLoading ()
{
System. Text. StringBuilder sb = new System. Text. StringBuilder ();
Sb. Append ("function pageLoad () {var manager = Sys. WebForms. PageRequestManager. getInstance ();");
Sb. Append ("manager. add_beginRequest (OnBeginRequest); manager. add_endRequest (OnEndRequest)} var lcPostbackElementID ;");
Sb. append ("function OnBeginRequest (sender, args) {lcPostbackElementID = args. get_postBackElement (). id. toLowerCase (); if (lcPostbackElementID ===\ "btnadwords \") {$ get (\ "btnAdWords \"). disabled = true; $ get (\ "btnAdWords \"). value = 'submitting... ';}}");
Sb. append ("function OnEndRequest (sender, args) {if (lcPostbackElementID ===\" btnadwords \ ") {$ get (\" btnAdWords \"). disabled = false; $ get (\ "btnAdWords \"). value = 'confirmed ';}}");
ScriptManager. RegisterStartupScript (Page, Page. GetType (), "btnAdWords", sb. ToString (), true );
}
You can also directly write it in the page script:
Copy codeThe Code is as follows:
<Script>
Function pageLoad ()
{
Var manager = Sys. WebForms. PageRequestManager. getInstance ();
Manager. add_beginRequest (OnBeginRequest );
Manager. add_endRequest (OnEndRequest)
}
Var lcPostbackElementID;
Function OnBeginRequest (sender, args)
{
LcPostbackElementID = args. get_postBackElement (). id. toLowerCase ();
If (lcPostbackElementID === 'btnadword ')
{
$ Get ('btnadword'). disabled = true;
$ Get ('btnadword'). value = 'submitting ...';
}
}
Function OnEndRequest (sender, args)
{
If (lcPostbackElementID ===\ "btnadwords \")
{
$ Get ('btnadword'). disabled = false;
$ Get ('btnadword'). value = 'OK ';
}
}
</Script>
For more information, see: http://msdn.microsoft.com/zh-cn/magazine/cc163319.aspx