I think I might just need a little nudge here, but I can't seem to work out how to "clean up" the button bar in the HTMLEditor.
I can easily remove items with something like:
Dim htmledit As WebHtmlEditor = TryCast(sender, WebHtmlEditor)htmledit.Toolbar.Items.Remove(ToolbarItemType.InsertFlash)
I have done this for many of the controls in the bar. However, I'm still left with the toolbar section of the removed controls - so there is a blank toolbar in my rendered editor.
Could you offer the code that would generate a toolbar similar to the one used in this forum? Simple, one row, a few basic HTML edit functions (cut, past, bold, bullet).
Wow...perfect. That's exactly what I was looking for. I went one step further, after marking all the toolbar items I wanted, I took the generated code and stuck it in my Themes folder - creating a skin.
Now, the control on my .aspx page looks like this:
<ighedit:WebHtmlEditor ID="WebHtmlEditor1" runat="server" SkinID="CommonHTMLBox" Width="400px" Text='<%# Bind("Agenda") %>' />
And my skin looks like this:
<ighedit:WebHtmlEditor SkinID="CommonHTMLBox" runat="server"> <DownlevelLabel Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> <DropDownStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> <ProgressBar Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> <DownlevelTextArea Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> <RightClickMenu Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"> <ighedit:HtmlBoxMenuItem runat="server" Act="Cut" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"> </ighedit:HtmlBoxMenuItem> <ighedit:HtmlBoxMenuItem runat="server" Act="Copy" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"> </ighedit:HtmlBoxMenuItem> <ighedit:HtmlBoxMenuItem runat="server" Act="Paste" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"> </ighedit:HtmlBoxMenuItem> <ighedit:HtmlBoxMenuItem runat="server" Act="PasteHtml" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"> </ighedit:HtmlBoxMenuItem> <ighedit:HtmlBoxMenuItem runat="server" Act="CellProperties" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"> <Dialog Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" InternalDialogType="CellProperties" /> </ighedit:HtmlBoxMenuItem> <ighedit:HtmlBoxMenuItem runat="server" Act="TableProperties" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"> <Dialog Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" InternalDialogType="ModifyTable" /> </ighedit:HtmlBoxMenuItem> <ighedit:HtmlBoxMenuItem runat="server" Act="InsertImage" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"> </ighedit:HtmlBoxMenuItem> </RightClickMenu> <TextWindow Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> <Toolbar Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Bold" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Italic" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Underline" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Cut" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Copy" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Paste" /> <ighedit:ToolbarImage runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Separator" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Undo" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Redo" /> <ighedit:ToolbarImage runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Separator" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="JustifyLeft" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="JustifyCenter" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="JustifyRight" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="JustifyFull" /> <ighedit:ToolbarImage runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Separator" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Indent" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Outdent" /> <ighedit:ToolbarImage runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="Separator" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="UnorderedList" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="OrderedList" /> <ighedit:ToolbarDialogButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="FontColor"> <Dialog Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> </ighedit:ToolbarDialogButton> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="CleanWord" /> <ighedit:ToolbarButton runat="server" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Type="WordCount" /> </Toolbar> <TabStrip Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /></ighedit:WebHtmlEditor>
The easiest way to get rid of lots of toolbar buttons is to use the Quick Design. In Visual Studio Design View, click the little right-facing arrow in the top right corner and from the smart tag that appears, choose "Quick Design."
Choose "Toolbar" in the left pane, and then in the middle of the Quick Design form you should see a long, vertical list of toolbar items. For example's sake, select the "Separator" item after "Paste" and then click the "Remove" button about 30-40 times until there are no more toolbar items after Paste. When that is done, click the "Apply" button. What this should give you is a short toolbar with font-formatting buttons and copy, cut, paste buttons and that's it.
The code for this you already have correct, this just saves you from having to repeat it over and over. If, there is anything you don't want to see in your Toolbar after doing essentially that same code you've shown 30-40 times to clear out most of the buttons, those are probably called the "Separators" and "Double Separators". There will be several of them, if you're really keen on removing them through code you can use the Items.LastIndexOf(ToolbarItemType.Separator) method to get their index (repeating the same until all DoubleSeparators and RowSeparators are gone, too) and then Items.RemoveAt(thatIndex) to remove them one-by-one. You can also Clear( ) the Items collection and add just the buttons you want to show-up.
As a side note, if you (or the next person to read this thread) want no toolbar items at all then you can set the WebHtmlEditor1.Toolbar.CssClass property to "HideToolbar" and define this CSS class in your page's header:
HTH,