In this tutorial, we will introduce you to the AJAX Timer Control. This Control can be used to initiate a refresh of an UpdatePanel in a certain timeframe. We are also able to refresh the entire page using the Timer Control. This simple examples illustrates how the Timer Control works and how to implement it.

First, we start by creating an AJAX-Enabled web site in Visual Studio .NET 2005, with the AJAX Extensions installed.
The AJAX Extensions (from Microsoft) make it a whole lot easier to create AJAX web pages, as Visual Studio will add in the necessary assembly references, etc. into the Web.config

When we first open our Default.aspx page, we should already have a Script Manager:

Next, we will create a Timer and an UpdatePanel:

Note the ontick and interval attributes of the Timer Control. The interval is in milliseconds, so every 5 seconds, the UpdateTimer_Tick method will be called.
Also note the eventname attribute of the Trigger. This tells the page what is going to cause (or trigger) the UpdatePanel to update.

Finally, we add logic to the code-behind. We are simply going to tell it to display the current time in a Label. This way we can see exactly when the UpdatePanel is being refreshed.

Download Source Files