Skip to main content

ASPxClientRichEdit.CustomCommandExecuted Event

Occurs after a custom command has been executed on the client side.

Declaration

CustomCommandExecuted: ASPxClientEvent<ASPxClientRichEditCustomCommandExecutedEventHandler>

Event Data

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

Property Description
commandName Gets the name of the processed command.
parameter Gets an optional parameter that complements the processed command.

Remarks

Handle the CustomCommandExecuted event to perform specific client actions in response to a command initiated by a click on a custom command (such as a ribbon item or context menu item) within the RIchEdt.

Note

The RichEdit’s default ribbon items are implemented by classes (RibbonItemBase decendants) whose names start with the ‘RER’ prefix. Ribbon items realized by other classes are considered to be custom within the RichEdit.

Example

ASPxRichEdit built-in spell checking support, including the type-as-you-go error detection. End-users can correct a misspelled word in the Spelling dialog. It can be opened using the corresponding context menu’s item when a cursor is over the misspelled word. This dialog allows a user to select spelling suggestions (they are also displayed in the context menu), change or ignore the error once or in all cases, and add a new word to the dictionary. You can also invoke the Spelling dialog using the client-side openSpellingDialog command. In this example, ASPxRichEdit includes a custom ribbon button: clicks on this item are processed using the client-side CustomCommandExecuted event. The event handler identifies the custom item via a command name and executes the openSpellingDialog command.

function onRichEditCustomCommandExecuted(s, e) {
    if(e.commandName = "OpenSpellingDialog") {
        RichEdit.commands.openSpellingDialog.execute();
    }
}
<dx:ASPxRichEdit ID="RichEdit" runat="server" ClientInstanceName="RichEdit">
    <ClientSideEvents CustomCommandExecuted="onRichEditCustomCommandExecuted" />
    <Settings>
        <SpellChecker Enabled="true" SuggestionCount="4">
        <Dictionaries>
            <dx:ASPxSpellCheckerISpellDictionary
                AlphabetPath="EnglishAlphabet.txt"
                GrammarPath="english.aff"
                DictionaryPath="american.xlg"
                Culture="English (United States)"
                CacheKey="ISpellDic">
            </dx:ASPxSpellCheckerISpellDictionary>
        </Dictionaries>
    </SpellChecker>
    </Settings>
    <RibbonTabs>
        <dx:RibbonTab Text="Review">
            <Groups>
                <dx:RibbonGroup Text="Proofing">
                    <Items>
                        <dx:RibbonButtonItem 
                            Name="OpenSpellingDialog"
                            Text="Spelling"
                            Size="Large"
                            LargeImage-IconID="format_spellcheck_32x32gray">
                        </dx:RibbonButtonItem>
                    </Items>
                </dx:RibbonGroup>
            </Groups>
        </dx:RibbonTab>
    </RibbonTabs>
</dx:ASPxRichEdit>
string documentId = "docId";
protected void Page_Load(object sender, EventArgs e) {
    if(!IsPostBack) {
        RichEditDocumentServer server = new RichEditDocumentServer();
        server.LoadDocument(Server.MapPath("~/SpellChecking.docx"));
        DocumentManager.CloseDocument(documentId);
        RichEdit.Open(documentId, DocumentFormat.OpenXml, () => server.OpenXmlBytes);
    }
}
See Also