

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->





























上面的代码是实现,点击Button1显示123 ,点击Button2显示321,
关键点在于 Button位置,如果Button在<ContentTemplate>中,则UpdateProgress中的内容可 以显示,如果说Button的位置在<ContentTemplate>外,既UpdatePanel的外部的话, UpdateProgress中的内容就不会显示了!
方法二:
如果Button的位置必需在UpdatePanel的外部的话,就得运用PageRequestManager中的initializeRequest事件和endRequest事件,代码如下:


<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><Triggers>
<asp:AsyncPostBackTriggerControlID="Button1"EventName="Event"/>
</Triggers>


<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->varprm=Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
varpostBackElement;
functionInitializeRequest(sender,args)
{
if(prm.get_isInAsyncPostBack())
args.set_cancel(true);
postBackElement=args.get_postBackElement();
if(postBackElement.id=='Button1')
$get('UpdateProgress1').style.display='block';
}
functionEndRequest(sender,args)
{
if(postBackElement.id=='Button1')
$get('UpdateProgress1').style.display='none';
}
原文: