Skip to main content

ASPxClientRichEdit.AutoCorrect Event

Fires when text is typed in the control.

#Declaration

TypeScript
AutoCorrect: ASPxClientEvent<ASPxClientRichEditAutoCorrectEventHandler>

#Event Data

The AutoCorrect event's data class is ASPxClientRichEditAutoCorrectEventArgs. The following properties provide information specific to this event:

Property Description
handled Specifies whether the event is handled.
interval Gets the input string’s interval.
text Gets the input string to check whether it should be replaced.

#Remarks

The AutoCorrect allows you to replace the typed text with any content using the Client API as demonstrated in the following code snipptet:

<script type="text/javascript">
    function OnAutoCorrect(s, e) {
        switch (e.text) {
            case "dxlogo":
                DemoRichEdit.selection.intervals = [e.interval];
                DemoRichEdit.commands.insertPicture.execute("../Content/logo.png");
                e.handled = true;
                break;
            case "bldtxt":
                DemoRichEdit.selection.intervals = [e.interval];
                DemoRichEdit.commands.changeFontBold.execute(true);
                DemoRichEdit.commands.insertText.execute("Bold Text");
                DemoRichEdit.commands.changeFontBold.execute(false);
                e.handled = true;
                break;
        }
    }
</script>

<dx:ASPxRichEdit ID="DemoRichEdit" ClientInstanceName="DemoRichEdit" runat="server">
    <ClientSideEvents AutoCorrect="OnAutoCorrect" />
</dx:ASPxRichEdit>

Note that the text event’s argument receives text starting after the last non-letter character (a space, punctuation mark, etc.).

See Also