Skip to main content
A newer version of this page is available. .

ASPxClientUtils.AttachEventToElement(element, eventName, method) Method

Binds the specified function to a specific element’s event, so that the function gets called whenever the event fires on the element.

Declaration

static AttachEventToElement(
    element: any,
    eventName: string,
    method: any
): void

Parameters

Name Type Description
element any

An object specifying the required element.

eventName string

A string value that specifies the required event name without the “on” prefix.

method any

An object that specifies the event’s handling function.

Remarks

Use the AttachEventToElement method to attach a handler to the specified DOM event. Note that this method can not be used to attach a handler to a DevExpress event. To learn how to handle DevExpress events, see the Client-Side Events topic.

Example

Note that the event’s name does not contain the “on” prefix.

<ClientSideEvents Init="MyOnInit" />
function MyOnInit(s, e) {
     ASPxClientUtils.AttachEventToElement(s.GetMainElement(), "dblclick", function (event) {
          //code here
     });
};
See Also