the method can be loaded on the server side:
Copy Code code 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= ' is submitting ...';}} ");
Sb. Append ("function Onendrequest" (sender, args) {if (Lcpostbackelementid = = \ "Btnadwords\") {$get (\ "Btnadwords\"). disabled = false; $get (\ "Btnadwords\"). value= ' OK ';} ");
Scriptmanager.registerstartupscript (Page, Page.gettype (), "Btnadwords", sb. ToString (), true);
}
can also be written directly in the page script:
Copy Code code 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 = = ' Btnadwords ')
{
$get (' btnadwords '). Disabled = true;
$get (' Btnadwords '). Value= ' is submitting ... ';
}
}
function Onendrequest (sender, args)
{
if (Lcpostbackelementid = = = \ "Btnadwords\")
{
$get (' btnadwords '). Disabled = false;
$get (' Btnadwords '). value= ' OK ';
}
}
</script>
For more information please refer to: http://msdn.microsoft.com/zh-cn/magazine/cc163319.aspx