Searching - Return node collection or array

2 posts, 0 answers
  1. Developer
    Developer avatar
    35 posts
    Member since:
    Apr 2014

    Posted 28 Jan Link to this post

    I have radtreeview control which has been bound with data.  I’ve like to search all the nodes (server side) and return all those with a specific attribute.
    I tried findbyattribute but this only returns a single node.  I’ve like to return a collection of nodes?
    Any idea how this can be accomplished please?
  2. Ivan Danchev
    Ivan Danchev avatar
    788 posts

    Posted 02 Feb Link to this post


    You can create a method which will check each node in the TreeView's NodeCollection and if it has an attribute with a specific value it will be added to a collection. For example:
    GetNodesWithAttributeValue("test", "123");

    private List<RadTreeNode> GetNodesWithAttributeValue(string attr, string attrValue)
        List<RadTreeNode> nodes = new List<RadTreeNode>();
        foreach (RadTreeNode node in RadTreeView1.GetAllNodes())
            if (node.Attributes[attr] == attrValue)
        return nodes;

    Ivan Danchev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top