Asp.Net Tree View selected node with pivot depth

I am creating an asp.net tree view by querying sharepoint user profiles. The account name to be selected and the root node account name are read from the query string.

I also need to have a custom exapanddepth for the tree.

How to choose a node if the node belongs to the 4th level and says that the expanddepth value is less than 4 (1,2 or 3).

Setting the corresponding node at the 4th level selected and setting the ExpandDepth property of the tree structure will not help.

Therefore, in essence, I need to save the tree extended to the selected node (only this navigation leading to the selected node), but save the other part of the tree only until it is defined using expanddepth.

thanks

+3
source share
1 answer

I have earned. It is pretty simple. From the node tree, select the selected node value path.

The path will have values ​​separated as indicated in the path separator. Continue to get the nodes that are part of the path of the value obtained above, starting with rootnode. For each node of the value path, just call the reversal function.

Please note that if we do not execute the loop and simply extend the node with the full path of values, the Treeview property ExpandDepth will occupy a prominent position, and therefore the visibility of the selected node actually depends on ExpandDepth in this scenario.

Hello

+1
source

Source: https://habr.com/ru/post/1721761/


All Articles