Skip to main content

ASPxClientUtils.PreventEventAndBubble(htmlEvent) Method

Cancels both the specified event’s default action and the event’s bubbling upon the hierarchy of event handlers.

#Declaration

TypeScript
static PreventEventAndBubble(
    htmlEvent: any
): boolean

#Parameters

Name Type Description
htmlEvent any

An object that specifies the required HTML event.

#Returns

Type Description
boolean

Always false.

#Remarks

You can use this method in the following manner, for instance:

myObject.onmousedown="return ASPxClientUtils.PreventEventAndBubble(event);"

#Example

This example demonstrates how the default browser processing of the Enter key, pressed while an ASPxTextBox has input focus, can be canceled with the help of a specific client method of a service ASPxClientUtils client object.

Note that the client script implementing the ASPxClientUtils object should be explicitly registered, to make this object available on the client:

protected void Page_Load(object sender, EventArgs e){
    DevExpress.Web.ASPxWebControl.RegisterBaseScript(Page);
}
See Also