Where to put System.Web.UI.Timer? Inside or outside of UpdatePanel?

If you put the Timer inside a UpdatePanel for asynchronous updates it will be rendered and reinitialized every time the post back is done. A better approach is to place the timer outside of the UpdatePanel (but inside of the same INamingContainer). Then a AsyncPostBackTrigger should be defined with a ControlID of the timer. That’s why we need to place the timer in the same INamingContainer – the Triggers do not support references to outters.

And also it is good to choose an optimized interval. If the timer is initiating a next post back when a previous one runs, the last mentioned one will be cancelled. If you set an interval to a small value it may create a significant traffic and performance hit.  If you set an interval to a large amount of time, the content may become outdated. The happy mean rules

Advertisements
This entry was posted in .NET. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s