Export (0) Print
Expand All

Timer::Interval Property

Gets or sets the number of milliseconds to wait before initiating a postback.

Namespace:  System.Web.UI
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public:
property int Interval {
	int get ();
	void set (int value);
}
<asp:Timer Interval="Int32" />

Property Value

Type: System::Int32
The number of milliseconds to wait before initiating a postback. The default value is 60,000 (60 seconds).

ExceptionCondition
ArgumentOutOfRangeException

The specified value is less than or equal to zero.

Use the Interval property to set how often the Timer control initiates a postback to the server. You can change the value of the Interval property in server code after a postback, such as in an event handler for the Tick event. The accuracy of when the Timer control posts back to the Web server depends on the accuracy of the ECMAScript (JavaScript) window.setTimeout function that runs in the browser.

NoteNote

Setting the Interval property to a small value can generate significant traffic to and from the Web server. Use the Timer control to refresh the content only as often as necessary.

When you change the value of the Interval property, the ECMAScript timing code running in the browser will be reset when the updates are rendered.

The following example shows an UpdatePanel control that displays a randomly generated stock price and the time that the stock price was generated. By default, the Timer control updates the content in the UpdatePanel control every 10 seconds. The user can decide to update the stock price every 10 seconds, every 60 seconds, or not at all. The Interval property is set to the user's choice.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft