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

TreeListView Expand All/ Collapse All Hierarchy Items

7 Answers 279 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Kumar
Top achievements
Rank 1
Kumar asked on 31 Aug 2011, 03:05 PM
Hello Telerik Team,

I want to expand / collapse all hierarchy levels of a RadTreeListView in C# code. 
I have multi level hierarchy items (generally 3-4 levels deep)

When I use
 
radTreeListView.ExpandAllHierarchyItems();
 
radTreeListView.CollapseAllHierarchyItems();

This only expands or collapses the first level hierarchy, the inner levels are left unchanged.

Any ideas on how to expand or collapse recursively all the way to the last level?

Thanks in Advance.
- Kumar

7 Answers, 1 is accepted

Sort by
0
Vera
Telerik team
answered on 01 Sep 2011, 04:45 PM
Hello Kumar,

Actually, I am not able to reproduce the issue you specified. Please take a look at the sample project attached and let me know if I am missing something according to your requirements.

All the best,
Vera
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Kumar
Top achievements
Rank 1
answered on 01 Sep 2011, 04:56 PM
Hey Vera,

Thanks for your reply and sample code. But this is not what I was looking for.

Let me explain using your attached example, please follow these steps:

  1. Run your code, this will open up the TreListView with everything collapsed
  2. Expand 'Drinks' node
  3. Expand 'Tea' node under Drinks
  4. Expand 'Mint' node under Tea
  5. Click Collapse button (Here I expect all the nodes under Drinks node including Tea and Mint to collapse)
  6. On clicking Collapse we see that the Drinks node has collapsed
  7. Expand Drinks node again and see that Tea and Mint nodes are still expanded. (this is not what I want in step 5)

I hope I am clear that when I hit the collapse button, all nodes and sub nodes till the last level should be collapsed, i.e. in this case on clicking Collapse button Drink, Tea, Mint nodes should all collapse.

Let me know if this can be done.

Regards,
Kumar

0
Vera
Telerik team
answered on 03 Sep 2011, 08:54 AM
Hi Kumar,

Thank you for the addtional information.
May I ask you to confirm that the version of the controls you have installed is the latest official Q2 2011?
If you use an older version I would suggest you to download Q2 2011 and everything should work properly.
I hope this helps. Let me know how it goes.

All the best,
Vera
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Kumar
Top achievements
Rank 1
answered on 01 Mar 2012, 09:22 PM
Is there any property that tells me the current state of RadTreeViewList's expandAll and CollapseAll ? 
0
Vlad
Telerik team
answered on 02 Mar 2012, 08:03 AM
Hi,

 With our latest official version (Q1 2012) you can use AutoExpandItems property of the treelist instead. 

Kind regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Kumar
Top achievements
Rank 1
answered on 02 Mar 2012, 07:46 PM
??

I am using the latest version of control. 

Let me rephrase my question. I have 2 buttons "Expand All" and "Collapse All". 

When you click on "Expand All" - i call this
radTreeListView.ExpandAllHierarchyItems();

When you click on "Collapse All" - i call this
radTreeListView.CollapseAllHierarchyItems();

I want disable each of the button based on if the "TreeListView" items are expanded or collapsed.  

0
Vlad
Telerik team
answered on 05 Mar 2012, 08:23 AM
Hello,

 As I said in my previous reply you should use AutoExpandItems  to achieve your goal however it seems that you've missed to try it. When you set this property to true the treelist will expand all items and when you set it to false all items will be collapsed. You can bind IsEnabled property of your buttons using IValueConverter to this boolean property. 

Regards,
Vlad
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
TreeListView
Asked by
Kumar
Top achievements
Rank 1
Answers by
Vera
Telerik team
Kumar
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or