I need to reverse loop through the parent nodes of a node to get the text of each node. So if my node structure is parent->child1->child2 I need to go loop child2->child1->parent. Any suggestions?
2 Answers, 1 is accepted
0
Bozhidar
Telerik team
answered on 20 Oct 2014, 07:08 AM
Hello,
Please review the following articles, which explain in detail the Client API of the TreeView control, and how you can use it to traverse the tree in whichever manner you need:
http://www.telerik.com/help/aspnet-ajax/treeview-client-basics.html
http://www.telerik.com/help/aspnet-ajax/treeview-client-objects-radtreenode.html
Regards,
Bozhidar
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I needed to do this serverside and start with a child that was checked and go in reverse through all it's parents to get the text of each one. I accomplished this by using (vb):
dim nodeText as string = childnode.text
If Not childnode.ParentNode Is Nothing Then
Dim parentnode As RadTreeNode = childnode.ParentNode
Do While Not parentnode Is Nothing
nodeText = parentnode.Text & "-" & nodeText
parentnode = parentnode.ParentNode
Loop
End If