I need to be able to select all the children of a Node when a node has been selected. Something similar to the interactive checkbox functionality but without the checkboxes. Any suggestions. Thanks.
ADAdministrator Syncfusion Team March 10, 2005 01:41 PM
The best way to do this is to handle the AfterSelect event and then recursively add all of the selected nodes'' children to the selection. The following code snippet demonstrates this:
private void treeViewAdv1_AfterSelect(object sender, System.EventArgs e)
TreeNodeAdvCollection tnc = new TreeNodeAdvCollection();
foreach (TreeNodeAdv n in this.treeViewAdv1.SelectedNodes)
foreach (TreeNodeAdv n in tnc)
private void AddChildren(TreeNodeAdvCollection tnc, TreeNodeAdv n)
foreach (TreeNodeAdv child in n.Nodes)
You''ll also need to set the SelectionMode to MultiSelectAll to allow a Node and its child to be selected simultaneously.
Hope this helps.