Expand to Single Node when using DataBind()?

2 posts, 0 answers
  1. Xorcist
    Xorcist avatar
    98 posts
    Member since:
    Apr 2009

    Posted 30 Nov 2010 Link to this post

    Currently all my data is being bound through a custom Hierarchy class, I'm having a bit of trouble expanding the structure to make the node I want visible... well... visible. I attempted to use MyTreeView.Nodes(MyIndex).Expanded = True directly after calling MyTreeView.DataBind() but it keeps telling me the index is out of range... but I'm fairly certain it is not. How would one go about expanding a single node of a TreeView without building it from scratch node by node.

    * My Bad, I forgot the Node structure was recursive. So I really needed to be working off MyTreeView.Nodes(0). I worked up a little code to get the results I needed, where "selected" is a string value for the text associated with the node I want to expand to:

        Dim Node as RadTreeNode
        Node = rtvHierarchy.FindNodeByText(selected)
        Node.Selected = True
        Node = Node.ParentNode
        do while not (Node is Nothing)
          Node.Expanded = True
          Node = Node.ParentNode
  2. Yana
    Yana avatar
    4916 posts

    Posted 02 Dec 2010 Link to this post


    You can use ExpandParentNodes() method of RadTreeNode to expand its parent nodes.

    All the best,
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top