Reverse Loop through Nodes

3 posts, 0 answers
  1. Tina
    Tina avatar
    31 posts
    Member since:
    Sep 2007

    Posted 15 Oct 2014 Link to this post

    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. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 20 Oct 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tina
    Tina avatar
    31 posts
    Member since:
    Sep 2007

    Posted 22 Oct 2014 in reply to Bozhidar Link to this post

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