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

Collapse treeview nodes except active node

2 Answers 153 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
deva
Top achievements
Rank 1
deva asked on 29 Jan 2011, 02:36 PM
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 Answers, 1 is accepted

Sort by
0
Stefan
Top achievements
Rank 1
answered on 30 Jan 2011, 11:31 PM
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.
0
deva
Top achievements
Rank 1
answered on 31 Jan 2011, 04:12 PM
This is what exactly i wanted...
It works great.. thank you for your timely reply
Tags
TreeView
Asked by
deva
Top achievements
Rank 1
Answers by
Stefan
Top achievements
Rank 1
deva
Top achievements
Rank 1
Share this question
or