zoukankan      html  css  js  c++  java
  • PageRequestManager 综述

     

    http://ajax.asp.net/docs/overview/PageRequestManagerOverview.aspx

    PageRequestManager 综述
    简介

    在Microsoft AJAX库中的PageRequestManager类在客户端上对局部页面呈现进行管理。当你的页面上有一个ScriptManager 和一个或者多个UpdatePanel控件的时候,这个页面就会自动的能够进行局部页面呈现。PageRequestManager 类提供了一些属性,方法以及事件,这些能够允许你使用客户端脚本对局部页面呈现进行定制。特别是PageRequestManager类提供了一个客户端事件模型,你能够象使用服务器页面事件模型那样来使用他。

    这篇文章包含了
              Scenarios(情节?假定?)
              PageRequestManager 属性
              背景
              代码例子
              类之间的关联

    Scenarios
            使用服务器控件ScriptManager和UpdatePanel进行局部页面呈现是很容易的,而且并不需要任何客户端脚本。
             当你想要完成下面的工作的时候,你可以使用PageRequestManager
                     控制多个异步回传是怎么样被处理的。The default behavior is that the last postback is honored,但是PageRequestManager类可以使你优先处理一个指定的postback并且取消其他正在进行的其他的postback.
                     提供可视化的提示或者其他的通知信息来标记那些被最近的异步回传刷新或者创建的页面的位置。这样在使用了多个UpdaePanel控件的地方能够提高用户的体验。
                     在异步回传的过程中显示消息的状态。如果回传需要花一段很长的时间去处理,你将会想要一个能够显示进度的指示器,比如一张动态的图片。你同样能够提供给用户一个选择来取消这个回传。
                     为局部页面呈现处理提供一个通用的错误信息。如果一个意外的错误在异步回传的时候发生了,你能够用AJAX风格的界面来处理这个错误。
                     在异步回传中存取优先的请求和应答。

    局部页面刷新的属性
    局部页面刷新的属性在Microsoft AJAX Library中包括了下面几种:
                客户端的页面生命周期事件,这些事件在局部页面刷新的关键时刻被激发。
                在一个异步回传中,关于哪些UpdatePanel控件被删除,刷新和创建的一些信息。
                一些属性和方法,能够允许你在客户端脚本中决定页面是否正在处理异步回传,停止一个正在发生的异步回传,并取消新的回传。
                 一些关于服务器数据的信息,这些数据发给那些没有参与到局部页面刷新中来的控件。 
    背景
      在使用了UpdatePanel控件的页面上的异步回传,发起局部页面刷新的过程中,RapgeRequestManager类对页面的内容慢慢被刷新的过程进行调整。UpdatePanle与PageRequestManager类将复杂的局部页面刷新抽象出来。通过使用脚本,你能够在浏览器中定制局部页面刷新。

    局部页面刷新的事件处理
    在页面处理的过程中(不管是普通的回传还是异步回传),你可以委托给DOM事件运行一个通用的脚本来处理。例如。当浏览器读取或者离开页面的时候,你可以运行脚本。然而这些DOM事件并不能使你在浏览器被读取和卸载发生异步回传和局部页面刷新的时候,获取信息或控制脚本事件。PageRequestManager类将下面的事件暴露出来,能够使得你定制页面的刷新。
              初始化请求
               开始请求
               页面读取
               页面读取完毕
                结束请求 
     想要知道更多关于这些事件的信息,查看ProgrammingUpdatePanelControls in Client Script.

    代码实例
    下面的代码实例展示了,当页面在一个异步回传后被刷新的时候,你可以怎样使用PageRequestManager类的pageLoaded事件来动态一个UpdatePanle控件。在这个例子中用户能够通过选择一个数据并输入一个Email地址到一个简单的from里面来激发一个请求。当从页面上确定了回传元素的时候,一个panle简要的动态通知用户,数据的值被输入到了textbox 中。页面包含了一个Popup能够显示一个Calendar控件。这个Calendar通过使用这个控件的Visible属性来决定是显示还是隐藏。在calendar上隐藏,显示,或者选择日期不会使的整个页面被刷新,因为这个calendar控件是在一个UpdatePanel控件里面。
    下面有更多的例子。

    How to and Walkthrough Topics

    Back to top

    Class Reference

    PageRequestManager Class

    Manages client partial-page rendering and exposes members for custom client scripting.

    InitializeRequestEventArgs Class

    Provides event data for the initializeRequest event, which is raised before the asynchronous request begins.

    BeginRequestEventArgs Class

    Provides event data for the beginRequest event, which is raised after the processing of an asynchronous postback begins and before the postback is sent to the server.

    PageLoadingEventArgs Class

    Provides event data for the pageLoading event, which is raised after the response from the server to an asynchronous postback is received, but before any content on the page is updated. This event is not raised if the postback is aborted or an exception occurs on the server during processing of the postback.

    PageLoadedEventArgs Class

    Provides event data for the pageLoaded event, which is raised after all content on the page is refreshed, regardless of whether it was refreshed because of a synchronous postback or an asynchronous postback. This event is not raised if the postback is aborted or an exception occurs on the server during processing of the postback.

    EndRequestEventArgs Class

    Provides event data for the endRequest event, which is raised after an asynchronous postback has completed.

    Back to top

  • 相关阅读:
    学习笔记——Maven实战(九)打包的技巧
    学习笔记——Maven实战(八)常用Maven插件介绍(下)
    学习笔记——Maven实战(七)常用Maven插件介绍(上)
    学习笔记——Maven实战(六)Gradle,构建工具的未来?
    学习笔记——Maven实战(五)自动化Web应用集成测试
    在Google的GKE上创建支持Internal Load Balancer的Service
    Bash命令查找本机公网IP
    Google Cloud IAM中添加自定义域名
    Debian上启用Apache2服务
    Google Cloud VM上在线扩硬盘
  • 原文地址:https://www.cnblogs.com/bingxuefly/p/578223.html
Copyright © 2011-2022 走看看