void AddOpenFileButton() { htmlEditor.CreateDefaultToolbars(true); var btn = new ToolbarCustomDialogButton("cdialog", "Open HTML File", false, true); btn.Image.Url = "~/icons/folder-open.ico"; htmlEditor.Toolbars[0].Items.Insert(0, btn); }
static void CreateInsertFileCommand(ASPxHtmlEditor htmlEditor) { var editorToolbar = htmlEditor.Toolbars.First(toolbar => toolbar.Items.Any(item => item.CommandName == "insertimagedialog")); var editorToolbarItem = editorToolbar.Items.First(item => item.CommandName == "insertimagedialog"); var index = editorToolbarItem.Index; var customToolbarButton = new ToolbarCustomDialogButton(InsertFileCommand, "Insert File...") { ViewStyle = ViewStyle.Image }; customToolbarButton.Image.Url = "~/Images/" + InsertFileCommand + ".png"; editorToolbar.Items.Insert(index, customToolbarButton); }
HtmlEditorToolbarItem EditorToolBarItem(IModelHtmlEditorToolBarItem modelHtmlEditorToolBarItem, HtmlEditorToolbar editorToolbar) { var commandName = modelHtmlEditorToolBarItem is IModelToolbarCustomDialogButton?modelHtmlEditorToolBarItem.GetValue <string>("Name") : modelHtmlEditorToolBarItem.GetValue <string>("Id"); var editorToolbarItem = editorToolbar.Items.FirstOrDefault(item => item.CommandName == commandName); if (editorToolbarItem == null) { editorToolbarItem = new ToolbarCustomDialogButton(); editorToolbar.Items.Add(editorToolbarItem); } return(editorToolbarItem); }