aspnetcore-js-devexpress-dot-richedit-ca21dd4e.md
An event that occurs when a key is pressed while the RichEdit’s document has focus.
export class KeyDownEvent extends RichEditEvent<KeyboardEventArgs>
You can define the KeyDown event handler either at the server side, at the client side, or at runtime.
Use the OnKeyDown(String) method to specify the event handler.
@(Html.DevExpress().RichEdit("richEdit")
.OnKeyDown("function(s,e) {
console.log('The pressed key is: ' + e.htmlEvent.key);
}")
// ...
Use the keyDown property to specify the event handler.
const options = DevExpress.RichEdit.createOptions();
options.events.keyDown = function(s,e) {
console.log('The pressed key is: ' + e.htmlEvent.key);
};
The keyDown property provides access to the addHandler(handler), removeHandler(handler), and clearHandlers methods that allow you to dynamically add and remove event handlers.
richEdit.events.keyDown.addHandler(function(s, e) {
console.log('The pressed key is: ' + e.htmlEvent.key);
});
The event handler receives an argument of the KeyboardEventArgs type. The argument’s properties provide information specific to this event.
Event<TSource, TEventArgs> RichEditEvent<TEventArgs> KeyDownEvent
See Also