tags:

views:

739

answers:

1

Hi,

I am constructing an asp.net tree view by querying sharepoint user profiles. The accountname that is to be selected and the root node accountname is being read from query string.

I also need to have configurable exapanddepth for the tree.

How do i select the node if the node belongs to the 4th level and say the expanddepth is less than 4 (1,2, or 3).

Setting relevant node in the 4 th level as selected and setting the ExpandDepth property of the treeview does not look to help.

So essentially, i need to keep the tree expanded untill the selected node(only that navigation that leads to the selected node) but keep other part of the tree expanded only till as defined by expanddepth.

Thanks

+1  A: 

I got it working. Its pretty simple. From the tree node, get the selected node value path.

The path will have values seperated as given in the path seperator. Keep getting on the nodes that are part of the value path got above starting from rootnode. For each node of the value path , just call the expand function.

Please note that if we dont do the loop and just expand the node with the full value path, the treeview's ExpandDepth property will take prominence and therefore the visiblilty of the selected node actually depends on the ExpandDepth in the present scenario.

Regards

Faiz