Skip to main content

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,
    onlyBubbling?: boolean,
    passive?: boolean
): 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.

onlyBubbling boolean
passive boolean

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.

Online Example

[!example[Page Control for ASP.NET Web Forms - How to display the page control in full screen mode (100% width and height)]https://github.com/DevExpress-Examples/asp-net-web-forms-page-control-full-screen-mode()]

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