I have a treeview control with a sitemap datasource which I use for a menu on a masterpage. All works fine, but I would like to:
1. Have all items collapsed at startup
2. Only expand the node selected and not all nodes when user click on a node
3. Be able to expand the node when click on the description as well as on the image.

Did I miss a few properties?
Please help.

10 Years
Discussion Span
Last Post by u4umang2001

I found the following:

If you set the ExpandDepth = 0 all nodes are collapsed at startup, but then for every click all nodes are collapsed again. Which is better than to have the entire tree expanded on every click. (I added a sitemappath at the top of the page to show where exactly you are in the treeview). Secondly, to be able to expand a node when you click on the description added the following code:

   protected void tvMenuNode_DataBound(Object sender, TreeNodeEventArgs e)
        if (e.Node.NavigateUrl == "")
            e.Node.SelectAction = TreeNodeSelectAction.Expand;


I still need to find a way to keep the selected node expanded.

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.