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

Dynamic TreeView and ContextMenus

3 Answers 64 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 11 Jun 2012, 05:57 PM
Hello,

I've looked in the forums, but I could not find the answer for my particular problem.

I am in the process of creating two TreeViews on my page.  The first one is a directory listing of ASPX pages within my website which I've gotten working already.  When the user clicks on the name of an ASPX page a second tree view will be populated containing the IDs of the controls contained within that page.  I put those IDs in a collection (ArrayList).  The second treeview's datasource is then set to the collection I've created which then gets displayed on the screen.  Up to this point I've gotten things to work.

Here's my issue:  I'm trying to dynamically create context menus for each node within the second treeview depending on what kind of control is selected (i.e. button, textbox, listbox, etc...).

I would really appreciate it if anyone can show me an example of how this can be done.

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 12 Jun 2012, 06:40 AM
Hi Shawn,

 
You can refer to this help topic where is explained how to create and use different Context Menus

Hope this will be helpful.

All the best,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Shawn
Top achievements
Rank 1
answered on 12 Jun 2012, 12:36 PM
Plamen,

Thank you for your post, however; I had already seen that help topic prior to my posting my question, and I was not able to apply it to my situation. 

Since my second tree is dynamically created when the user clicks on an item from the first tree I can not be sure of the type of web control that is displayed in the tree, and the order it is displayed within the tree.  As far as I could see the example code in the help file requires you to know the order of nodes in the tree.  For that reason I can't apply the solution in the help topic (as far as I could see). 

I need to be able to apply a context menu to the nodes based on what they are (i.e. their value: textbox, botton, listbox, etc...) no matter what order they are in within the tree (I will not know their oder before hand since it will be dynamic).

Thanks.
0
Shawn
Top achievements
Rank 1
answered on 12 Jun 2012, 01:09 PM
Plamen,

Please disregard my previous post.  I had missunderstood the help topic answer.  It does work for me.  Thanks!
Tags
TreeView
Asked by
Shawn
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Shawn
Top achievements
Rank 1
Share this question
or