The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxClientHtmlEditor.CustomCommand Event

Enables you to implement a custom command's logic.

Declaration

CustomCommand: ASPxClientEvent<ASPxClientHtmlEditorCommandEventHandler<ASPxClientHtmlEditor>>

Event Data

The CustomCommand event handler receives an argument of the ASPxClientHtmlEditorCommandEventArgs type. 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

The CustomCommand event occurs on the client side when executing a command whose name (returned by the ASPxClientHtmlEditorCommandEventArgs.commandName property) doesn't coincide with any default command names listed by the ASPxClientCommandConsts object's constants.

Handle the CustomCommand event to implement the required logic for the executed custom command. You can, for instance, manually execute a set of default commands by handling this event.

Examples

The example below demonstrates how to manipulate ASPxHtmlEditor View Areas by CustomToolbarButton.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxHtmlEditor.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxHtmlEditor" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxSpellChecker.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxSpellChecker" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript">
        function OnCustomCommand(s, e) {
            if(e.commandName == "close") {
                cp.PerformCallback("closed");
            }
            if(e.commandName == "open" || e.commandName == "new")
                if(confirm("Are you sure?"))
                cp.PerformCallback("opened");
        }    
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <dx:ASPxCallbackPanel ID="cp" runat="server" ClientInstanceName="cp" OnCallback="cp_Callback">
        <PanelCollection>
            <dx:PanelContent ID="PanelContent1" runat="server" SupportsDisabledAttribute="True">
                <dx:ASPxHtmlEditor ID="htmlEditor" runat="server">
                    <ClientSideEvents CustomCommand="OnCustomCommand" />
                    <Toolbars>
                        <dx:HtmlEditorToolbar>
                            <Items>
                                <dx:CustomToolbarButton CommandName="new" Text="New">
                                </dx:CustomToolbarButton>
                                <dx:CustomToolbarButton CommandName="open" Text="Open">
                                </dx:CustomToolbarButton>
                                <dx:CustomToolbarButton CommandName="save" Text="Save">
                                </dx:CustomToolbarButton>
                                <dx:CustomToolbarButton CommandName="close" Text="Close">
                                </dx:CustomToolbarButton>
                            </Items>
                        </dx:HtmlEditorToolbar>
                    </Toolbars>
                </dx:ASPxHtmlEditor>
            </dx:PanelContent>
        </PanelCollection>
    </dx:ASPxCallbackPanel>
    </form>
</body>
</html>
See Also