Timer in UpdatePanel

Is there a specifc reason why you have the Timer control in the UpdatePanel?

Every time I have needed to use a Timer control to cause an UpdatePanel refresh, I have set it up like the following and it works fine with MasterPages:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> 
    <Triggers>
        <asp:AsyncPostBackTrigger  ControlID="Timer1" EventName="Tick" />
    </Triggers>
    <ContentTemplate> 
        <!-- your content here, no timer -->
    </ContentTemplate> 
</asp:UpdatePanel> 

<asp:Timer ID="Timer1" runat="server" Interval="5000" OnTick="Timer1_Tick">
</asp:Timer> 

Use the Trigger to cause the UpdatePanel to refresh from the Tick event. You only want to embed content in your UpdatePanel if possible.

Leave a Comment