Hi,

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.
Thanx

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.

you may try :::

treeid.CollapseAll();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.