Patrick's File Collection

Just do what I like!!
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Build your own UpdateProgress panel

Posted on 2006-11-02 10:26  Patrick Zhang  阅读(487)  评论(0编辑  收藏  举报
just by using the core ASP.NET Ajax extentions beta 1
(this example is taken from the ASP.NET Ajax documentation on page http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass.aspx)

Assuming you have a scriptmanager on your page, an updatepanel and an html DIV-element (named 'myUpdatePanel' with style='visibility:hidden;').  'myUpdatePanel' contains the text/image you want to show when the UpdatePanel is waiting to update itself.

<script type="text/javascript" language="javascript">
 
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler)

 
function BeginRequestHandler(sender, args)
  {
    ActivateAlertDiv(
'visible', 'myUpdatePanel');
  }

  function EndRequestHandler(sender, args)
  {
    ActivateAlertDiv(
'hidden', 'myUpdatePanel');
  }

  function ActivateAlertDiv(visstring, elem)
  {
   
var adiv = $get(elem);
   
adiv.style.visibility = visstring;
  }
</script>