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

Show/Hide Expand-Collapse button(+/-) in treeview

2 Answers 725 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Remya
Top achievements
Rank 1
Remya asked on 30 Mar 2012, 05:57 AM
Hi,

I am binding the parent nodes to a treeview initially and intends to bind the children of each node on LoadOnDemand.I am checking whether each parent node is having child nodes on initial bind to show or hide the expand-collapse button.I want to hide the expand-collapse button for those nodes who doesn't have any child.

Help me.
Thnx in advance.

2 Answers, 1 is accepted

Sort by
0
Remya
Top achievements
Rank 1
answered on 30 Mar 2012, 11:16 AM
Hi,

I solved this issue.
Ranjitha
Top achievements
Rank 1
commented on 18 Dec 2024, 05:01 PM

I am trying to do the same. Can you please let me know how did you solve this? 
Nadya | Tech Support Engineer
Telerik team
commented on 20 Dec 2024, 11:26 AM

Hello, Ranjitha,

By default, when a parent node has child nodes it shows the expand-collapsed buttons. If it has not any child nodes, then this button is not shown. This behavior is normal and would come out of the box. Can you please share more information about the case that you have. Is your RadTreeView bound or not? 

If you are facing difficulties, it would be very helpful if you can provide a simplified project and demonstrate there the problem that you are having. Thus, I could be able to investigate it further.

Looking forward to your reply.

1
Julian Benkov
Telerik team
answered on 03 Apr 2012, 05:46 PM
Hello Remya,

I am glad to hear that you have solved your issue. 

Generally speaking, you can turn off the LazyMode property to support this scenario:

treeView.LazyMode = false;

Do not hesitate to contact us if you have further questions or issues. 

Greetings,
Julian Benkov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Geoff
Top achievements
Rank 1
commented on 24 Apr 2025, 05:51 PM

Thanks Julian, this worked for me.

I had a weird situation recently on an old app. Although in our development environment the tree view nodes looked fine, when deployed, the expand icon started appearing on all the tree nodes once one of them had been clicked, regardless of whether they had children or not?

After applying the setting above and doing a new build, they went away.

Geoff

 

 

Tags
Treeview
Asked by
Remya
Top achievements
Rank 1
Answers by
Remya
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or