Back to Devexpress

ASPxTimer Class

aspnet-devexpress-dot-web-e9e5a270.md

latest6.4 KB
Original Source

ASPxTimer Class

Represents a timer.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public class ASPxTimer :
    ASPxWebComponent,
    IRequiresLoadPostDataControl
vb
Public Class ASPxTimer
    Inherits ASPxWebComponent
    Implements 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.25.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.

aspx
<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

csharp
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);
}
vb
Imports DevExpress.Web

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim spinEdit As ASPxSpinEdit = New ASPxSpinEdit()
    spinEdit.ID = "spinEdit"
    spinEdit.Number = 0
    spinEdit.ClientInstanceName = "ClientSpinEditor"
    Page.Form.Controls.Add(spinEdit)

    Dim timer As ASPxTimer = 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)
End Sub

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.

Implements

Show 14 items

IComponent

IDisposable

IParserAccessor

IDataBindingsAccessor

IControlBuilderAccessor

IControlDesignerAccessor

IExpressionsAccessor

IAttributeAccessor

IUrlResolutionService

INamingContainer

IPostBackDataHandler

IPostBackEventHandler

ICallbackEventHandler

IPropertiesOwner

Inheritance

Object Control WebControl ASPxWebControlBase ASPxWebControl ASPxWebComponent ASPxTimer

See Also

ASPxTimer Members

ASPxClientTimer

News Control

DevExpress.Web Namespace