Collapse treeview nodes except active node

3 posts, 0 answers
  1. deva
    deva avatar
    10 posts
    Member since:
    Jul 2010

    Posted 29 Jan 2011 Link to this post

    Hi in my application i have a treeview control ...
    In the pageload i have initialized to collapse all the nodes
    The problem is when all the nodes get expanded i am unable to accomodate the list on the page  and it gets scrolled...
    I need to keep the active selected node displayed with all the other parent nodes collapsed  and if i select the other node the previous active node should get collapsed, so that only one node will be active and the rest will be in collapsed state. I hope you got my scenario and will provide a solution for it.

  2. Stefan
    Stefan avatar
    16 posts
    Member since:
    Jun 2010

    Posted 30 Jan 2011 Link to this post

    I'm not sure if I'm reading your question correctly, but when you say "I need to keep the active selected node displayed with all the other parent nodes collapsed" you mean you want to collapse all nodes that aren't on the path from the root node to the selected node?

    If so, the control has a property called SingleExpandPath you can set:
    <telerik:RadTreeView ID="RadTreeView" runat="server" SingleExpandPath="true" />
    
    
    That will ensure you can only have one node (per tree level) expanded at a time.
  3. deva
    deva avatar
    10 posts
    Member since:
    Jul 2010

    Posted 31 Jan 2011 Link to this post

    This is what exactly i wanted...
    It works great.. thank you for your timely reply
Back to Top