Navigation Type TreeView - Avoid Rendering Hidden Nodes

2 posts, 0 answers
  1. gfaus
    gfaus avatar
    2 posts
    Member since:
    Sep 2006

    Posted 19 Mar 2009 Link to this post

    I have a TreeView instance that is bound to a SiteMapXmlData source.  All nodes have a bound NavigateUrl property.   I'm utilizing the tree view as a means to navigate a website.

    How do I avoid rendering the HTML mark-up for nodes that are not displayed (e.g. not expanded)? Currently all of these nodes are hidden via "display:none".  Since I'm posting back on every click there is no need to toggle node visibility client-side which creates a lot of extra mark-up which I like to avoid.

    Neither the NodeCreated and NodeDataBound events seem to help to determine what nodes get written out with "display:none" style.  The node "Visible" properties are always true and the attribute "display" is empty.

    Thanks.
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 19 Mar 2009 Link to this post

    Hi gfaus,

    RadTreeView renders all tree nodes added in the Nodes collection no matter if they are initially visible or not. If you want to hide nodes that are not expandable you should traverse their parent nodes to see if they are expanded.

    Regards,
    Albert
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top