Hi,
I wanna access all nodes(include all treeviews) in RadTreeView,I try to use Foreach like:
but it return just top level nodes.How can I access all nodes in a foreach?
Regards,
Mohsen.
I wanna access all nodes(include all treeviews) in RadTreeView,I try to use Foreach like:
foreach (var node in RadTreeView1.Nodes) { }Regards,
Mohsen.
4 Answers, 1 is accepted
0
Mohsen
Top achievements
Rank 1
answered on 13 Jul 2013, 04:19 AM
Anyone?
0
Accepted
Mohsen
Top achievements
Rank 1
answered on 14 Jul 2013, 10:11 AM
I find a simple solution with recursive method to enumerate treeview nodes, I write that here for those one need that in the future!
So, If you want to get all nodes in a treeview, start it with blow few code:
private static void CheckTreeViewNodes(IEnumerable<RadTreeNode> treeNodeCollection) { foreach (var node in treeNodeCollection) { //Do some thing you need to do! CheckTreeViewNodes(node.Nodes); } }So, If you want to get all nodes in a treeview, start it with blow few code:
CheckTreeViewNodes(treeView.Nodes);0
Dickson
Top achievements
Rank 1
answered on 03 Aug 2018, 09:30 AM
Thank you, I'm am using it right now!
0
Hello,
There is a method for this as well:
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
There is a method for this as well:
var allNodes = tempTree.TreeViewElement.GetNodes().ToList();Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
