Poorna
Poorna

Reputation: 323

ContextMenu in ASPxHtmlEditor

I am developing asp.net project in c#.In my application i use Devexpress htmleditors and i need custom conetxtmenu . So i tried to add conextmenu item from code behind but i got following errors.

1.DevExpress.Web.ASPxHtmlEditor.ASPxHtmlEditor.ContextMenuItems' is inaccessible due to its protection level

2.The property or indexer 'DevExpress.Web.ASPxHtmlEditor.ASPxHtmlEditor.ContextMenuItems' cannot be used in this context because the get accessor is inaccessible

And this wht i tried in code behind.

htmlEdtBody.ContextMenuItems.Insert(0, new HtmlEditorContextMenuItem("Add Title...", "AddTitle"));

Anyone one knows what is the reason for that?

Thank you

Upvotes: 0

Views: 874

Answers (1)

Niranjan Singh
Niranjan Singh

Reputation: 18290

I suggest you to go through ASPxHtmlEditor's demo - Features - Context Menu, there is a nice demo, that help you understand how this will work.

Firstly set the ASPxHtmlEditorSettings.AllowContextMenu property. You may have to ASPxClientHtmlEditor.ContextMenuShowing event. ASP.NET HTML Editor Control

Refer - Context Menu

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"));
     }
}

this - ASPxGridView - Editing using popup menu and ContextMenu event may help you..

Upvotes: 1

Related Questions