Custom button command

  •  09-13-2006, 3:44 PM

    Custom button command

    Hi,

    I'm trying to get a custom button into the editor that works like the other buttons command-wise.  I want to be able to catch the button press in the editor's post back command method.  I'm not sure how to progmatically set the command name of the button.  Here is an idea of what I have implemented already.

    private void Editor1_PostBackCommand(object sender, System.Web.UI.WebControls.CommandEventArgs e)
    {
        if (string.Compare(e.CommandName, "customButtonCommandName", true) == 0)
           do stuff.....
    }

    And the button...

    WebControl ctrl = editor.CreateCommandButton("customButton", "page.gif", "My Custom Button");
    int pos = editor.ToolControls.IndexOf("lcase") + 1;
    editor.InsertToolControl(pos, "customButton", ctrl);

    Wher I click this button I get an alert popup that says:

    Command [customButton] Is not supported!

    Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMNSHTMLDocument.execCommand]

    Any ideas on how to register a command name with this button?  Thanks!
View Complete Thread