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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Selecting all the leaf nodes of the parent node

Thread ID:





39953 Jan 21,2006 08:00 AM UTC Jan 31,2006 06:14 AM UTC WinForms 2
Tags: Tools
Administrator [Syncfusion]
Asked On January 21, 2006 08:00 AM UTC

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.

Deepa TS [Syncfusion]
Replied On 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


Administrator [Syncfusion]
Replied On January 31, 2006 06:14 AM UTC

It helped me. Thanx!!


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon