Skip to main content

HtmlEditorContextMenuItemCollection.CreateDefaultItems() Method

Populates the context menu with default items.

Namespace: DevExpress.Web.ASPxHtmlEditor

Assembly: DevExpress.Web.ASPxHtmlEditor.v24.2.dll

NuGet Package: DevExpress.Web

#Declaration

public void CreateDefaultItems()

#Remarks

Use the CreateDefaultItems method, to manually create default context menu items within the HtmlEditorContextMenuItemCollection.

Custom items can be added to the HtmlEditorContextMenuItemCollection collection using the collection’s HtmlEditorContextMenuItemCollection.Add or Collection<T>.Insert method.

#Example

The code sample below demonstrates how you can handle the ASPxClientHtmlEditor.ContextMenuShowing event to change the content of a context menu (by changing its items visibility).

protected void Page_Load(object sender, EventArgs e) {
     if (!IsPostBack) {
          MyHtmlEditor.ContextMenuItems.CreateDefaultItems();
          MyHtmlEditor.ContextMenuItems.Insert(0, new HtmlEditorContextMenuItem("Add Title...", "AddTitle"));
          MyHtmlEditor.ContextMenuItems.Insert(1, new HtmlEditorContextMenuItem("Change Title...", "ChangeTitle"));
          MyHtmlEditor.ContextMenuItems.Insert(2, new HtmlEditorContextMenuItem("Remove Title", "RemoveTitle"));
     }
}
See Also