Treeview won't collapse/expand dynamically


P

pej.odonnell

Hello everyone,

2 Issues: 1. When treeview renders all parent nodes are open? I want
it to render closed? 2. When I try to collapse programmatically, it
does not do anything?

I'm using a tree view with a sitemap to create a menu. The treeview
is contained in a master page.

<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1" ImageSet="Simple" Width="249px">
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True"
ForeColor="#5555DD" />
<SelectedNodeStyle Font-Underline="True"
ForeColor="#5555DD" HorizontalPadding="0px"
VerticalPadding="0px" />
<NodeStyle Font-Names="Tahoma" Font-
Size="10pt" ForeColor="Black" HorizontalPadding="0px"
NodeSpacing="0px" VerticalPadding="0px" / </asp:TreeView>

Here's the code I tried in the Page Load event of the Master page:

TreeView1.CollapseAll();

I would appreciate any suggestions. Thanks.
 
Ad

Advertisements

T

T. Church

Hi,

I ended up putting the CollapseAll control into the treeview's
DataBound event instead of page load - that way you collapse it after
it's done loading the data.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top