Remove Toolbar Buttons of WebHtmlEditor

By default, the WebHtmlEditor™ control displays all toolbar buttons (and drop-down lists) in the toolbar region. You should remove any toolbar buttons which your editor application does not require. You can easily accomplish this programmatically in the code-behind file.

  1. Before you start writing any code, you should place using/imports directives in your code-behind so you don’t need to always type out a member’s fully qualified name.

In Visual Basic:

Imports Infragistics.WebUI.WebHtmlEditor

In C#:

using Infragistics.WebUI.WebHtmlEditor;
  1. Look up the ToolbarItemType enumeration values corresponding to the buttons not required by your Web application.

For example, if you do not want your Web application to support uploading and attaching media files, you can remove your end users' access to the following buttons:

  • InsertFlash

  • InsertWindowsMedia

  • InsertImage

  1. In the code-behind file, add code to an event handler (for example, the Page_Load handler) occuring before render to remove these buttons if they exist in the ToolbarItemCollection class using its Remove method which takes a ToolbarItemType as its argument.

In Visual Basic:


In C#: