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 Select All in TreeViewAdv

How do you programatically select all the nodes in a TreeViewAdv? Do you really have to spin through the whole tree adding them to the treeViewAdv1.SelectedNodes, or is there a faster way? Cheers

3 Replies

MB Matthew Brohn August 27, 2004 09:46 AM

Actually.. treeViewAdv1.SelectedNodes.Clear(); treeViewAdv1.SelectedNodes.AddRange(treeViewAdv1.Nodes); this seems to work pretty well...


MB Matthew Brohn August 30, 2004 10:26 AM

Sigh.. Nevermind this only adds the top level nodes.. So back to square one.. is there a easy way to select all the nodes programatically? -M


AD Administrator Syncfusion Team August 30, 2004 11:55 AM

Hi, You could use the TreeViewAdv''s ExtendSelectionTo method for this purpose as shown in the code below : this.treeViewAdv1.SelectedNode = this.treeViewAdv1.TopVisibleNode; this.treeViewAdv1.ExtendSelectionTo(this.treeViewAdv1.LastVisibleNode); Please refer to the test sample attached here that shows how this can be done, and let me know if this meets your requirements. Thanks for your interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon