This is a migrated thread and some comments may be shown as answers.

[Solved] Loop through all nodes

1 Answer 532 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mikael
Top achievements
Rank 1
Mikael asked on 24 Apr 2008, 11:32 AM

Hi,

I want to loop through all of the trees nodes, selecting a specific node, and then expand all parent nodes.

Ive been trying to use this code to do this.
Apparently this will only loop through the root nodes, witch i only have one of, please help me.

foreach (RadTreeNode NodeToExpand in rtvMenu.Nodes)
{
    if(Convert.ToInt32(NodeToExpand.Value) == OptionalMenuId)
     {
        NodeToExpand.ExpandParentNodes();
    }
}

//DG

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 24 Apr 2008, 12:34 PM
Hello Mikael,

Indeed the Nodes property will return only the root nodes of the RadTreeView. Please use the GetAllNodes method to get all nodes:

foreach (RadTreeNode node in rtvMenu.GetAllNodes())
{
}

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Mikael
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or