Dynamic TreeView and ContextMenus

4 posts, 0 answers
  1. Shawn
    Shawn avatar
    5 posts
    Member since:
    Jun 2012

    Posted 11 Jun 2012 Link to this post

    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.
  2. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 12 Jun 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shawn
    Shawn avatar
    5 posts
    Member since:
    Jun 2012

    Posted 12 Jun 2012 Link to this post

    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.
  5. Shawn
    Shawn avatar
    5 posts
    Member since:
    Jun 2012

    Posted 12 Jun 2012 Link to this post

    Plamen,

    Please disregard my previous post.  I had missunderstood the help topic answer.  It does work for me.  Thanks!
Back to Top