Asp.net ASP定时器控件正在刷新整个页面?

Asp.net ASP定时器控件正在刷新整个页面?,asp.net,asp.net-ajax,webforms,Asp.net,Asp.net Ajax,Webforms,我有一个ASP定时器控件,应该每三分钟运行一次。虽然我将计时器控件保留在更新面板中,但它每次运行时都会刷新整个页面 是否存在只刷新页面的特定部分而不是整个页面的问题 <div> <asp:UpdatePanel ID="UpdatePanel4" runat="server"> <ContentTemplate> <asp:Timer ID="Timer1" runat="serve

我有一个ASP定时器控件,应该每三分钟运行一次。虽然我将计时器控件保留在更新面板中,但它每次运行时都会刷新整个页面

是否存在只刷新页面的特定部分而不是整个页面的问题

<div>
        <asp:UpdatePanel ID="UpdatePanel4" runat="server">
            <ContentTemplate>
                <asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick" Interval="300000" >
                </asp:Timer>
            </ContentTemplate>
        </asp:UpdatePanel>               
    </div>

您需要使用UpdatePanel触发器,和msdn来源


您需要使用UpdatePanel触发器,和msdn来源


使用“更新面板”并添加不希望通过任何事件刷新或回发的所有控件的内部更新面板

使用“更新面板”并添加不希望通过任何事件刷新或回发的所有控件的内部更新面板

        <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: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>