This is a migrated thread and some comments may be shown as answers.

Load on Demand - Expand Node programaticly

2 Answers 86 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Dirk Eberhardt
Top achievements
Rank 1
Dirk Eberhardt asked on 02 Dec 2009, 06:56 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Roland
Top achievements
Rank 1
answered on 02 Dec 2009, 03:17 PM
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.
0
Dirk Eberhardt
Top achievements
Rank 1
answered on 02 Dec 2009, 04:04 PM
Thanks for your help.

Now it works! :)
Tags
TreeView
Asked by
Dirk Eberhardt
Top achievements
Rank 1
Answers by
Roland
Top achievements
Rank 1
Dirk Eberhardt
Top achievements
Rank 1
Share this question
or