Timer in UpdatePanel

I have an asp:UpdatePanel with an asp:Timer. These are in a Master/Content Page. The code is below:

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

But when the timer fires, I get the folowing error:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near ‘

This works in a standalone web form, but not in a content page with a master page.

Can anyone explain a fix for this?

Thanks in advance for any help!!


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

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"> 
        <asp:AsyncPostBackTrigger  ControlID="Timer1" EventName="Tick" />
        <!-- your content here, no timer -->

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

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

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x