locked
CSS Friendly TreeView RRS feed

  • Question

  • User-525527400 posted

    I downloaded and added support for css friendly controls. Everything works except for a issue with the treeView. When I click a linked node and post to the page the treeView collapses instead of selecting the node. When I exclude the CSSFriendly.browsers from my project it works again. Any suggestions on this cause I really need this functionality.

    Thanx Mike,

    Friday, May 12, 2006 9:15 AM

All replies

  • User-534056067 posted

    Hi Mike, can you help me better understand the issue here?  If you are observing that the adapted TreeView doesn't retain a memory of its state-of-expansion after posting back... then this is a known limitation of the current TreeView adapter.  It's already something that I've got on the to-do list for a future rev of this sample kit.  Basically, it involves sending a bit more info (concerning what is expanded) back to the server during these postbacks so the server can restore the expansion state when the page is sent back down.

    There is some intersection between this feature and another to-do item: populating the TreeView nodes upon demand, rather than always having all the nodes defined all the time. Hopefully, we can nail both of these enhancements to the adapted TreeView code in a not-too-distant rev of the adapter kit.

    Meanwhile, maybe someone in the community of forum readers would like to suggest some code we could stick in the current CSSFriendly.MenuAdapter with some cut-n-paste magic.

    Friday, May 12, 2006 12:56 PM
  • User-525527400 posted

    Hi Russ!

    I´m aware of that the treeView doesn´t remember it´s state of expansion and I know of the workarounds. To be honest I´m not sure why this works for me(I don´t fix what isn´t broken) but the code below does the trick with no code beside.

    <asp:TreeView ID="articleTreeView" runat="server" 
       DataSourceID="SiteMapDataSourceArticleTree"
       SkinID="tree"
       EnableClientScript="true"
       EnableViewState="true" >
       <DataBindings>
          <asp:TreeNodeBinding
             DataMember="SiteMapNode" 
             NavigateUrlField="Url" 
             SelectAction="Expand" 
             TextField="Title" />
        </DataBindings>
    </asp:TreeView>

    Without CssFriendlyAdapters this selects the node and expands the tree after postback. With CssFriendlyAdapters the tree closes and the current node isn´t styled as selected. The SiteMapPath connected to the same provider however shows the correct path. Any suggestions because I need the css functionality to style my tree.

    Thanx! /Mike

    Monday, May 15, 2006 5:06 AM
  • User-534056067 posted
    Beta 3 of the kit, posted to http://www.asp.net/cssadapters earlier this week, supports automatic reexpansion of the adapted TreeView.
    Thursday, October 26, 2006 12:02 PM
  • User256567865 posted

    Hi,

    How can I put CSS Friendy Tree View Expansion State into memory?

    For example, say I have a Tree View and when you click on the node it will navigate to other page (not just post back to same page) and on that next page I want to display the selected Tree Node.

    The only way I think it could be done is if I attach to TreeNodeCollpased and TreeNodeExpanded event and put the expansion state in Session then display it on the other page. The problem is I cant attach to these 2 events (could be because I use CSS Friendly Adapters).

    Please help.....

    Thanks

    Monday, January 21, 2008 1:11 AM
  • User1724078176 posted

    Hi,

    Can we apply css to Treeview... node level wise...?

    Means,

    One css to Parent Nodes,

    One css to second level nodes. (Same css shd b applied even if it is leaf node)

    ??

    Wednesday, July 1, 2009 8:29 AM