5 Answers, 1 is accepted
0
Hi KevinMc,
You can call the ExpandAllNodes() server-side method of the treeview:
Kind regards,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You can call the ExpandAllNodes() server-side method of the treeview:
RadTreeView1.ExpandAllNodes(); |
Kind regards,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

KevinMc
Top achievements
Rank 1
answered on 11 Jul 2008, 02:29 PM
It is a treeview in a combobox. If i put this in the page_load method i get null reference exception probably because it is not bound to the datasource yet.
RadTreeView cats = (RadTreeView)comboCategories.FindControl("treeCategories"); |
cats.ExpandAllNodes(); |
Where should i set the expandallnodes at in this scenario?
0
Hello KevinMc,
You need to use this code:
Now it should find the treeview properly.
Regards,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You need to use this code:
RadTreeView cats = (RadTreeView)comboCategories.Items[0].FindControl("treeCategories"); |
cats.ExpandAllNodes(); |
Now it should find the treeview properly.
Regards,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

KevinMc
Top achievements
Rank 1
answered on 11 Jul 2008, 02:57 PM
Adding items on findcontrol corrects the null reference exception but the treeview still is not expanded.
0
Accepted
Hi KevinMc,
Here is another idea: subscribe to the OnClientDropDownOpening event of the combobox, find the treeview, loop thought its nodes and expand them:
Kind regards,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Here is another idea: subscribe to the OnClientDropDownOpening event of the combobox, find the treeview, loop thought its nodes and expand them:
function OnClientDropDownOpeningHandler(sender, eventArgs) |
{ |
var tree = $find('<%= RadComboBox1.Items[0].FindControl("RadTreeView1").ClientID %>'); |
var nodes = tree.get_allNodes(); |
for (var i = 0; i < nodes.length; i++) |
{ |
if (nodes[i].get_nodes() != null) |
{ |
nodes[i].expand(); |
} |
} |
} |
Kind regards,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center