The ASP.NET AJAX Timer control performs postbacks at defined intervals. If you use the Timer control with an UpdatePanel control, you can enable partial-page updates at a defined interval. You can also use the Timer control to post the whole page.
The Timer control requires specific settings in a web.config file in order to function correctly. If you try to work with this control, and your site doesn't contain the required web.config file, errors appear in the Design view of the page where the control would have appeared. In Design view, if you click the control that is in that state, Microsoft Expression Web will give you the option to create a new web.config file or update your existing web.config file.
You use the Timer control when you want to do the following:
Periodically update the contents of one or more UpdatePanel controls without refreshing the whole web page.
Run code on the server every time that a Timer control causes a postback.
Synchronously post the whole web page to the web server at defined intervals.
An instance of the ScriptManager class must be included in the web page when you use the Timer control.
When a postback was initiated by the Timer control, the Timer control raises the Tick event on the server. You can create an event handler for the Tick event to perform actions when the page is posted to the server.
Set the Interval property to specify how often postbacks will occur, and set the Enabled property to turn the Timer on or off. The Interval property is defined in milliseconds and has a default value of 60,000 milliseconds, or 60 seconds.
Setting the Interval property of a Timer control to a small value can generate significant traffic to the web server. Use the Timer control to refresh the content only as often as necessary.
You can include more than one Timer control on a web page if different UpdatePanel controls must be updated at different intervals. Alternatively, a single instance of the Timer control can be the trigger for more than one UpdatePanel control in a web page.
Using a Timer Control Inside an UpdatePanel Control
When the Timer control is included inside an UpdatePanel control, the Timer control automatically works as a trigger for the UpdatePanel control. You can override this behavior by setting the ChildrenAsTriggers property of the UpdatePanel control to false.
Using a Timer control outside an UpdatePanel control
When the Timer control is outside an UpdatePanel control, you must explicitly define the Timer control as a trigger for the UpdatePanel control to be updated.
You must set the Interval property to a value that enables one asynchronous postback to complete before the next postback is initiated. If a new postback is initiated while an earlier postback is being processed, the first postback is canceled.
For more information about the Timer control, see Timer Control Overview in the MSDN Library.
For a description of all Timer control properties, see Timer Properties in the MSDN library.