We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Selecting all the leaf nodes of the parent node

Hi forum, Will I be able to select all the leaf nodes of the parent node if I only select the parent node. Any ideas that will be helpful for me?!!! Thanks, Regards, Peter.

2 Replies

DT Deepa TS Syncfusion Team January 23, 2006 10:15 AM UTC

Hi Peter, You can select all the leaf nodes of the parent node by only selecting the parent node by handling the AfterSelect Event handler. private void treeViewAdv1_AfterSelect(object sender, System.EventArgs e) { TreeNodeAdvCollection tn = new TreeNodeAdvCollection(); foreach (TreeNodeAdv n in this.treeViewAdv1.SelectedNodes) { this.AddChildren(tn, n); } foreach (TreeNodeAdv n in tn) { this.treeViewAdv1.SelectedNodes.Add(n); } } private void AddChildren(TreeNodeAdvCollection tn, TreeNodeAdv n) { foreach (TreeNodeAdv child in n.Nodes) { tn.Add(child); this.AddChildren(tn, child); } } Please take a look at the attached sample and let me know if this helps you. Thanks for your interest in Syncfusion products. Regards, Deepa.T.S

LeafNodes.zip


AD Administrator Syncfusion Team January 31, 2006 06:14 AM UTC

It helped me. Thanx!!

Loader.
Live Chat Icon For mobile
Up arrow icon