This example illustrates how to:
- Handle a specific event (for example, "keydown") within a whole document object;
- Perform a specific action when a specific keyboard key (for example, ESC) is pressed.
The client-side ASPxClientUtils.AttachEventToElement method allows for attaching a handler to the "keydown" event over the "document" object.
ASPxButton.aspx:
Clicking the "Escape" key calls the client-side ASPxClientButton.DoClick method and invokes the custom alert message to inform an end-user of the clicked key.
OBSOLETE:
Starting with version v2014 vol 2 (v14.2), this functionality is available out of the box. Simply set the ASPxPopupControl.CloseOnEscape property to true to activate it. Please refer to the Popup Control - Main Features demo to see this feature in action.
ASPxPopupControl.aspx:
Clicking the "Escape" key hides ASPxPopupControl via the client-side ASPxClientPopupControl.Hide method.