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

Programatically selecting all the nodes in the treeview adv....

Hi forum, I am workin in treeviewadv, just dropped by to know whether there is any way to programatically select all the nodes in the treeview adv... Thanks in advance. Regards, Jane

4 Replies

DT Deepa TS Syncfusion Team January 6, 2006 02:12 PM UTC

Hi Jane, You can programatically select all the nodes in the treeViewAdv with the help of following code snippet. private void button1_Click(object sender, System.EventArgs e) { this.treeViewAdv1.ExtendSelectionTo(this.treeViewAdv1.LastVisibleNode); this.treeViewAdv1.Focus(); } Please take a look at the attached sample and let me if this helps you. Thanks for using syncfusion products. Regards, Deepa.T.S

SelectAllnodes.zip


AD Administrator Syncfusion Team January 9, 2006 12:05 PM UTC

Hi Deepa, I need to select all the nodes, not only the visible nodes in the tree. Is there a way. Thanks in advance. Regards, Jane


DT Deepa TS Syncfusion Team January 9, 2006 01:15 PM UTC

Hi Jane, Sorry for the inconvenience caused.I do see that the nodes that are not present in the visible area do not get selected. To solve this problem, please use the following code snippet. private void button1_Click(object sender, System.EventArgs e) { foreach (TreeNodeAdv node in this.treeViewAdv1.Root.Nodes) { this.treeViewAdv1.SelectedNodes.Add(node); TreeNodeAdv lastNode = node.LastNode; while (lastNode != null) { this.treeViewAdv1.ExtendSelectionTo(lastNode); lastNode = lastNode.LastNode; } } this.treeViewAdv1.Focus(); } Please take a look at the modified attached sample,and let me know if this meets your requirements. Thanks for your continued interest in Syncfusion products. Regards, Deepa.T.S

SelectAllnodes0.zip


AD Administrator Syncfusion Team January 10, 2006 11:30 AM UTC

It works!!!

Loader.
Live Chat Icon For mobile
Up arrow icon