• ajax中 同一页面中 UpdatePanel 区别 更新多个区域的关键 timer使用方法


    关键是将updatepanel的 UpdateMode  设置为 UpdateMode ="Conditional"  默认的话是always 所以同一个页面中的不同updatepanel 总不同时更新,觉的十分不爽,我们设置为 UpdateMode ="Conditional" ,即条件更新后,情况就不同了。
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode ="Conditional" >
                
    <ContentTemplate>
                    
    1---<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                    
    <br />
                    
    <asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" />
            
    <asp:Button ID="Button1" runat="server" Text="Button" />

    接下来我们再在我们想要触发更新的updatepanel 中加入

    <Triggers ><asp:AsyncPostBackTrigger ControlID ="Button2"  EventName ="Click" /></Triggers>
    这样的话呢,点击button时的updatepanel2才更新呦。好的问题解决了,和大家共享吧。

    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode ="Conditional">
                <ContentTemplate>
                    2---<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
                </ContentTemplate>
                <Triggers ><asp:AsyncPostBackTrigger ControlID ="Button2"  EventName ="Click" /></Triggers>
            </asp:UpdatePanel>
    下面的是使用timer
    <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode ="Conditional" >
                
    <ContentTemplate>
                    
    <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="1000" >
                    
    </asp:Timer>
                    
    <asp:Label ID="Label3" runat="server" Text="Label"></asp:Label><br />
                
    </ContentTemplate>
            
    </asp:UpdatePanel>
  • 相关阅读:
    Git 分支[转]
    监听键盘的输入事件[转]
    github for windows的初步使用
    限制一个form被同时打开的数量 Limite The Number of Forms Opened at the same time
    android内存检测工具
    面试 9.26 总结
    canvas path paint 的使用(游戏必备)
    android知识点
    android查缺补漏
    AIDL的使用
  • 原文地址:https://www.cnblogs.com/ma/p/724440.html
Copyright © 2020-2023  润新知