Treeview won't collapse/expand dynamically

Discussion in 'ASP .Net' started by pej.odonnell, Jul 16, 2007.

  1. pej.odonnell

    pej.odonnell Guest

    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.
     
    pej.odonnell, Jul 16, 2007
    #1
    1. Advertisements

  2. pej.odonnell

    T. Church Guest

    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
     
    T. Church, Jul 16, 2007
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.