Load on Demand - Expand Node programaticly

3 posts, 1 answers
  1. Dirk Eberhardt
    Dirk Eberhardt avatar
    18 posts
    Member since:
    Jul 2009

    Posted 02 Dec 2009 Link to this post

    Good Morning,
    I've created a RadTreeView with Data from a SQL Table. I load the Data on demand like in this example (Client Side):

    http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/loadondemandmodes/defaultcs.aspx

    How can I expand a path to a spacial Childnode programaticly?

    I tried it with:
    RadTreeView.FindNodeByValue("NODEVALUE").ExpandParentNodes(); 




    But that doesn't work. I think beacause the data is not loaded at this time.

    Any ideas how to do that?

    Thanks in advance

    Regards
    Dirk
  2. Answer
    Roland
    Roland avatar
    156 posts
    Member since:
    Feb 2009

    Posted 02 Dec 2009 Link to this post

    Hello,

    Given the node you want to expand, you need to do something like this:

    var parent = node.Parent; 
     
    while(parent != null
       parent.Expanded = true
       parent = parent.Parent; 

    Put this somewhere after you add your node as child node in the method that creates the node.
  3. Dirk Eberhardt
    Dirk Eberhardt avatar
    18 posts
    Member since:
    Jul 2009

    Posted 02 Dec 2009 Link to this post

    Thanks for your help.

    Now it works! :)
Back to Top