ASP timer Control is refreshing the whole page?

你说的曾经没有我的故事 提交于 2019-12-02 03:58:53

        <asp:Timer runat="server" id="UpdateTimer" interval="200" ontick="function" />

        <asp:UpdatePanel runat="server" id="TimedPanel" updatemode="Conditional">

            <Triggers>
                <asp:AsyncPostBackTrigger controlid="UpdateTimer" eventname="Tick" />
            </Triggers>

            <ContentTemplate>
                <asp:Label runat="server" id="label1" />
                <asp:TextBox ID="textbox1" runat="server"></asp:TextBox>
            </ContentTemplate>

        </asp:UpdatePanel>     
 <asp:UpdatePanel ID="UpdatePanel4" runat="server">
   <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
  </Triggers>
  <ContentTemplate>
   <asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick" Interval="300000"></asp:Timer>
            </ContentTemplate>
        </asp:UpdatePanel> 

you need to use UpdatePanel Triggers. Conditional Update Panels with triggers, and msdn source. Updatepanel with Triggers

   <asp:UpdatePanel ID="UpdatePanel4" runat="server">
       <ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
    </Triggers>
<asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick" Interval="300000"> </asp:Timer>
                </ContentTemplate>
            </asp:UpdatePanel> 

Use update panel and add all the control's inside update panel which you don't want to be refreshed or postback by any event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!