Skip to main content
Tab

ASPxTimer Class

Represents a timer.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public class ASPxTimer :
    ASPxWebComponent,
    IRequiresLoadPostDataControl

Remarks

The ASPxTimer generates recurring events at specified time intervals. The ASPxTimer.Interval property allows the time before the ASPxTimer.Tick event is raised relative to the last occurrence of the ASPxTimer.Tick event.

Create a Timer Control

Design Time

The ASPxTimer control is available on the DX.24.1: Components toolbox tab in the Microsoft Visual Studio IDE.

Drag the control onto a form and customize the control’s settings, or paste the control’s markup in the page’s source code.

<dx:ASPxTimer ID="ASPxTimer" runat="server" Interval="500" ClientInstanceName="ClientTimer">
    <ClientSideEvents Tick="function(s, e) {ClientSpinEditor.SetValue(ClientSpinEditor.GetValue() + 1);}" />
</dx:ASPxTimer>
<dx:ASPxSpinEdit ID="spinEdit" runat="server" ClientInstanceName="ClientSpinEditor" Number="0"></dx:ASPxSpinEdit>

Run Time

using DevExpress.Web;
...
protected void Page_Load(object sender, EventArgs e)
{
    ASPxSpinEdit spinEdit = new ASPxSpinEdit();
    spinEdit.ID = "spinEdit";
    spinEdit.Number = 0;
    spinEdit.ClientInstanceName = "ClientSpinEditor";
    Page.Form.Controls.Add(spinEdit);

    ASPxTimer timer = new ASPxTimer();
    timer.ID = "ASPxTimer";
    timer.Interval = 500;
    timer.ClientInstanceName = "ClientTimer";

    timer.ClientSideEvents.Tick = "function(s, e) {ClientSpinEditor.SetValue(ClientSpinEditor.GetValue() + 1);}";
    Page.Form.Controls.Add(timer);
}

Note

DevExpress controls require that you register special modules, handlers, and options in the Web.config file. You can change this file or switch to the Design tab in the Microsoft Visual Studio IDE to automatically update the Web.config file. Note that this information is automatically registered if you use the DevExpress Template Gallery to create a project.

The ASPxTimer control provides you with a comprehensive client-side functionality implemented using JavaScript code:

The client-side API is always available for this control. This API includes the ASPxClientTimer.SetInterval and ASPxClientTimer.SetEnabled methods.

For an example on how to manipulate the ASPxTimer component on the client side, see Timer - Client-Side Functionality demo.

See Also