This documentation is archived and is not being maintained.

Timer::Enabled Property

Gets or sets a value that indicates whether the Timer control initiates a postback to the server after the number of milliseconds specified in the Interval property has elapsed.

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

public:
property bool Enabled {
	bool get ();
	void set (bool value);
}
<asp:Timer Enabled="True|False" />

Property Value

Type: System::Boolean
true if Timer will initiate a postback; otherwise, false. The default value is true.

Use the Enabled property to turn the Timer control on and off. When you set Enabled to true, the Timer control starts its timer countdown when the Web page is rendered.

On postback, you can change property values in the Enabled property, and the changes will be reflected when the Web page content is rendered in the browser. If you change the Enabled property and then change it back to its original value during the same postback, the Timer control runs as if no change had been made.

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. When the user decides not to update the stock price, the Enabled property is set to false.

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

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5
Show: