Skip to main content
Tab

ASPxTimer Class

Represents a timer.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v21.2.dll

Declaration

public class ASPxTimer :
    ASPxWebComponent,
    IRequiresLoadPostDataControl

Remarks

Create a Timer Control

Design Time

The ASPxTimer control is available on the DX.21.2: 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="timer">
    <ClientSideEvents Tick="function(s, e) {spinEditor.SetValue(spinEditor.GetValue() + 1);" />
</dx:ASPxTimer>
<dx:ASPxSpinEdit ID="spinEdit" runat="server" ClientInstanceName="spinEditor" 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 = "spinEditor";
    Page.Form.Controls.Add(spinEdit);

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

    timer.ClientSideEvents.Tick = "function(s, e) {spinEditor.SetValue(spinEditor.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 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.

Note

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.

The ASPxTimer‘s client-side API includes two methods: the ASPxClientTimer.SetInterval and ASPxClientTimer.SetEnabled.

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

See Also