Back to Devexpress

KeyDownEvent Class

aspnetcore-js-devexpress-dot-richedit-ca21dd4e.md

latest2.7 KB
Original Source

KeyDownEvent Class

An event that occurs when a key is pressed while the RichEdit’s document has focus.

Declaration

ts
export class KeyDownEvent extends RichEditEvent<KeyboardEventArgs>

Remarks

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.

cshtml
@(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.

javascript
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.

javascript
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.

Inherited Members

addHandler(handler)

clearHandlers

isEmpty

removeHandler(handler)

Inheritance

Event<TSource, TEventArgs> RichEditEvent<TEventArgs> KeyDownEvent

See Also

Client-Side Events