Back to Devexpress

Client-Side Events

aspnet-9448-common-concepts-client-side-functionality-client-side-events.md

latest4.9 KB
Original Source

Client-Side Events

  • Aug 03, 2025
  • 4 minutes to read

DevExpress ASP.NET controls include an advanced client-side API that improves web application efficiency with server-side and client-side processing. Client-side events apply web application logic on the client in response to end user operations.

Client-Side Events Editor

Use the Client-Side Events editor (located within the control’s Designer, as shown below) to write a client-side event handler. This editor displays a list of available client-side events, and allows you to add an event handler to an event. The editor automatically adds the code to the markup.

A control’s Designer can be launched in the following ways:

  • Click the control’s Smart Tag and select Designer… from the invoked drop down list.

  • Right-click the control and choose Designer… in the context menu.

  • Select the control, open its Properties window, and select Designer… below.

  • Select the control, open its Properties window, and click the ClientSideEvents property’s ellipsis button (as shown below) or a specific client-side event’s ellipsis.

To create an event handler, choose the required event on the left, and write the corresponding event handler code on the right. Note that the Designer automatically generates a default event handler signature within the Event Handler Body pane.

Click OK to add the corresponding aspx code to markup automatically.

aspx
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="ASPxButton" AutoPostBack="False">
     <ClientSideEvents Click="function(s, e) {
          alert('The Click event has been invoked');
     }" />
</dx:ASPxButton>

Note that you can also write similar code to create an event handler directly in an aspx file.

Client-side Event Handler Signature

A client-side event handler signature is similar to the standard server-side version. The default signature is illustrated below.

aspx
<ClientSideEvents EventName="function(s, e) { ... }" />

An event handler function has two parameters:

  • the s parameter returns the client object that raises the event;

  • the e parameter returns the event argument, which typically contains event-specific information.

Note that you should use the s object instead of the ClientInstanceName property to access the source of an event handler.

aspx
<dx:ASPxGridView ClientInstanceName="grid" ... >
    <ClientSideEvents RowDblClick="function(s, e) {
        //grid.StartEditRow(e.visibleIndex);
        s.StartEditRow(e.visibleIndex);
    }" />
    ...
</dx:ASPxGridView>

How to Assign an Event Handler

For each client-side event that is handled, you must specify a JavaScript function to be executed when the event is triggered. You can assign functions in the following ways.

Note

Register Javascript functions at the top of the page to ensure that the browser executes these scripts before it renders DevExpress ASP.NET components.

See Also

Client-Side Functionality

IntelliSense for Client API