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

951022 - how to get all nodes of a tree view

1 Answer 134 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Hamid
Top achievements
Rank 1
Hamid asked on 11 Jan 2017, 11:52 AM

I don't use a data source for a RadTreeView. Instead, I add and remove the nodes individually. I use OnFilter to specify which nodes to be shown. When some nodes are hidden, in a part of my program, I need the list of ALL nodes including the hidden ones, while Nodes includes just the shown nodes. I investigated and found no property to hold them.

Any idea?

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 12 Jan 2017, 10:59 AM
Hi Hamid,

You need to clear the filter while iterating the nodes:
private void radButton2_Click(object sender, EventArgs e)
{
    var filter = radTreeView1.Filter;
    radTreeView1.Filter = null;
    GetNodes(radTreeView1.Nodes);
    radTreeView1.Filter = filter;
}
public void GetNodes(RadTreeNodeCollection nodes)
{
    foreach (var item in nodes)
    {
        Console.WriteLine(item.Text);
        if (item.Nodes.Count > 0)
        {
            GetNodes(item.Nodes);
        }
    }
}

I hope this information is useful. Let me know if you need further assistance.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
General Discussion
Asked by
Hamid
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or