Skip to main content

HtmlEditorContextMenuItem(String, String) Constructor

Initializes a new instance of the HtmlEditorContextMenuItem class with the specified settings.

Namespace: DevExpress.Web.ASPxHtmlEditor

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

NuGet Package: DevExpress.Web

Declaration

public HtmlEditorContextMenuItem(
    string text,
    string commandName
)

Parameters

Name Type Description
text String

A String value that specifies the created context menu item’s display text. Initializes the item’s HtmlEditorContextMenuItem.Text property.

commandName String

A String value that identifies the executed command. This value is assigned to the HtmlEditorContextMenuItem.CommandName property.

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