Updatepanel的基础用法(1)

来源:互联网 发布:北京网易班车路线 知乎 编辑:程序博客网 时间:2024/05/05 07:26
 

 1.<div>
    Conditional:该UpdatePanel内的内容只会在该UpdatePanel内部有回发时更新
    <br />
    always:会在本页面有回发时更新,而不管这个回发是不是在其UpdatePanel内部发生
    <br />
    尽量避免使用always,因为它会在每次页面有回发时都会进行更新
    </div>
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
         <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Block" >
        <ContentTemplate>
        <%=DateTime.Now %>
            <asp:Button ID="Button1" runat="server" Text="Button" />
        </ContentTemplate>
        </asp:UpdatePanel>
         <asp:UpdatePanel ID="UpdatePanel2" runat="server" RenderMode="Block" UpdateMode="Conditional">
        <ContentTemplate>
        <%=DateTime.Now %>
            <asp:Button ID="Button2" runat="server" Text="Button" />
        </ContentTemplate>
        </asp:UpdatePanel>
    </div>

 

2.UpdateMode="Conditional" ChildrenAsTriggers="false":这种情况下,该UpdatePanel内部不会更新

 

3. PostBackTrigger:刷新整个页面
    AsyncPostBackTrigger:刷新关联的UpdatePanel
    注意:ChildrenAsTriggers为false的时候,该UpdatePanel中的按钮还是会引起回发,只是不会更新与之关联的UpdatePanel,
    但是会更新UpdateMode为always的UpdatePanel

 

4. page对象在生成过程中有个render环节,就是生成代码,使用reponse对象输出,若是updatepanel存在于
    这个环节,isinpartialrendering属性就为true。同步刷新为true,一步刷新为false


 

原创粉丝点击