Skip to main content

ASPxClientSpreadsheet.CustomCommandExecuted Event

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

Declaration

CustomCommandExecuted: ASPxClientEvent<ASPxClientSpreadsheetCustomCommandExecutedEventHandler<ASPxClientSpreadsheet>>

Event Data

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

Property Description
commandName Gets the name of the processed command. Corresponds to the item’s Name property value.
item Obsolete. This property is now obsolete. Use the ASPxClientSpreadsheetCustomCommandExecutedEventArgs.commandName property instead.
parameter Gets an optional parameter that complements the processed command.

Remarks

The CustomCommandExecuted event occurs after a custom ribbon or context menu command has been clicked.

The Spreadsheet’s default ribbon items are implemented as RibbonItemBase descendants whose names start with the SR prefix, for instance, SRFileSaveCommand. Ribbon items implemented by other classes are considered as custom.

Handle the CustomCommandExecuted event to perform specific client actions after a custom command has been executed on the client side. Use the event argument commandName property to identify the processed custom command. The property returns the Name property value of the corresponding item.

<dx:ASPxSpreadsheet ID="Spreadsheet" runat="server" ShowConfirmOnLosingChanges="False">
       <ClientSideEvents CustomCommandExecuted="onCustomCommand" />
    <RibbonTabs>
        <dx:SRHomeTab>
            <Groups>
                <dx:RibbonGroup Name="Group1" Text="Group1">
                    <Items>
                        <dx:RibbonButtonItem Name="MyButton1" Text="Button1" />
                        <dx:RibbonButtonItem Name="MyButton2" Text="Button2" />
                    </Items>
                </dx:RibbonGroup>
            </Groups>
        </dx:SRHomeTab>
    </RibbonTabs>
<%-- ... --%>
function onCustomCommand(s,e) {
    console.log(e.commandName); // prints "MyButton1" for the first item and "MyButton2" for the second
}
See Also