Search code examples
c#asp.netteleriktreeviewradtreeview

Check whether all nodes in a particular Level are selected in Telerik RadtreeControl using C#


Is there a way we could check whether all the nodes in a particular Level of a Telerik RadTreeControl are Selected using C# code(preferably LINQ)

I am using the the below code to get the Value for the Checked nodes in Level 1

selectedValues = string.Join(",", radTree.CheckedNodes.Where(node => node.Level == 1).Select(node => node.Value).ToArray());

Thanks in advance!


Solution

  • Try looping through the nodes, checking their level and what their Checked property returns:

        List<RadTreeNode> lvlOneNodes = RadTreeView1.GetAllNodes().Where(node => node.Level == 1).ToList();
        foreach (RadTreeNode item in lvlOneNodes)
        {
            Response.Write(item.Checked);
        }