Traversing from selecting node to parent node

  • Thread starter Thread starter Abdul H S via DotNetMonster.com
  • Start date Start date
A

Abdul H S via DotNetMonster.com

I am facing difficulty to make sql on the basis of user selected node in
treeview.After selection of the particulare treenode I want to traverse the
hierarchy up to rootnode.plz help me regarding this.

Thanks
 
You use reverse recursion. Instead of passing the child node
and iterating through child nodes, you do the exact oppositie.

You call the method recursively always passing the node.ParentNode
as the parameter testing each time to see if .ParentNode is null
(or possible equal to itself).
 
Back
Top