This is a migrated thread and some comments may be shown as answers.

Contextmenu when moving to Prometheus

5 Answers 93 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
FU
Top achievements
Rank 2
FU asked on 05 May 2008, 01:46 PM

I have a problem moving the contextmenus from the ASP.NET-treeview to the ASP.NET AJAX-treeview.

I loaded the contextmenus for differenct nodetypes like this:
myTree.ContextMenuContentFile = "AllMenus.xml";

It seems I have to split the AllMenus.xml into an xml-file for each nodetype and load it like this:
RadTreeViewContextMenu contextMenu = new RadTreeViewContextMenu();

contextMenu.LoadContentFile("Menu1.xml");
myTree.ContextMenus.Add(contextMenu);

contextMenu.LoadContentFile("Menu2.xml");
myTree.ContextMenus.Add(contextMenu);

contextMenu.LoadContentFile("Menu3.xml");
myTree.ContextMenus.Add(contextMenu);

But when I rightclick on any node it shows the standard IE-contextmenu. What am I doing wrong or not doing at all?

5 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 05 May 2008, 02:20 PM
Hi Mickey13,

To display different context menu for each node you should set the ContextMenuID properties of the nodes as shown in the attached sample project. Please download the files and give them a go.

I hope this will get you started.

Best wishes,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
FU
Top achievements
Rank 2
answered on 06 May 2008, 06:14 AM
I already did this as it works the same way in the RadControls for ASP.NET-treeview. My problem is that if I replace the existing/working RadControls for ASP.NET-treeview with the new RadControls for ASP.NET AJAX-treeview I can't get it to show the context-menu.

It seems I have two problems:
1. If I load several XML-files as in my previous post, I get a JavaScript-error "Sys.InvalidOperationException: A control is already associated with the element.".

2. If I only load one XML-file I don't get any errors but also no contextmenu.
0
Nikolay
Telerik team
answered on 06 May 2008, 07:11 AM
Hello Mickey13,

There have been changes in the built-in context menu of the treeview. Therefore, I attached a sample project that shows the needed approach. I used your logic so that the project can get you started. Have you run the project I attached? Can you apply the same approach to your application?

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
FU
Top achievements
Rank 2
answered on 06 May 2008, 07:44 AM
Sorry. Didn't realize you had made a complete example. Thanks for the great sample that showed all the needed changes.
0
Nikolay
Telerik team
answered on 06 May 2008, 08:05 AM
Hi Mickey13,

I am glad I could help.

Kind regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
FU
Top achievements
Rank 2
Answers by
Nikolay
Telerik team
FU
Top achievements
Rank 2
Share this question
or