951022 - how to get all nodes of a tree view

Thread is closed for posting
2 posts, 0 answers
  1. Hamid
    Hamid avatar
    3 posts
    Member since:
    Apr 2012

    Posted 11 Jan Link to this post

    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?

  2. Dimitar
    Admin
    Dimitar avatar
    1871 posts

    Posted 12 Jan Link to this post

    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.
Back to Top