I'm attempting to load up a RadTreeView a level at a time, and on-demand.
I've successfully loaded the root nodes, and am able to load the child nodes when the expand button is clicked.
All of the child nodes can potentially have child nodes of their own, but I don't want to load them until the expand button is clicked...
The problem is that none of my child nodes have the expand/collapse button! Where do I enable this for an individual node?
I've successfully loaded the root nodes, and am able to load the child nodes when the expand button is clicked.
All of the child nodes can potentially have child nodes of their own, but I don't want to load them until the expand button is clicked...
The problem is that none of my child nodes have the expand/collapse button! Where do I enable this for an individual node?
3 Answers, 1 is accepted
0
Accepted
Hi Anthony,
When you add the child nodes in the NodeExpand event handler you need to set their ExpandMode property to either ServerSide, ServerSideCallBack or WebService. So, they will have the plus sign and will fire NodeExpand event if you click it.
On the contrary, if you set the ExpandMode to ClientSide (the default) they will not have the plus sign.
I hope this helps.
Sincerely yours,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
When you add the child nodes in the NodeExpand event handler you need to set their ExpandMode property to either ServerSide, ServerSideCallBack or WebService. So, they will have the plus sign and will fire NodeExpand event if you click it.
On the contrary, if you set the ExpandMode to ClientSide (the default) they will not have the plus sign.
I hope this helps.
Sincerely yours,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Anthony
Top achievements
Rank 1
answered on 17 Jul 2008, 03:27 PM
I'm still having this same problem...
Here's where I load up the root nodes the first time around...
These root nodes display properly. When you click a node, I have this event handler...
Details of LoadChildNodes()...
The child nodes are display properly, but DO NOT have the expand button.
Any thoughts?
Thanks for the help!
Here's where I load up the root nodes the first time around...
private void LoadRootNodes() |
{ |
tvFilters.Nodes.Clear(); |
Survey s = SurveyService.Instance.Get(new Guid(SurveyID)); |
// add each category in the survey to the top level of the tree |
foreach (Category currCat in s.Categories) |
{ |
RadTreeNode node = new RadTreeNode(); |
node.Text = currCat.Label; |
node.Value = currCat.Id.ToString(); |
node.Attributes.Add(_nodeType, _nodeTypeCategory); |
node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack; |
tvFilters.Nodes.Add(node); |
} |
} |
These root nodes display properly. When you click a node, I have this event handler...
protected void tvFilters_NodeExpand(object sender, RadTreeNodeEventArgs e) |
{ |
LoadChildNodes(e.Node); |
} |
Details of LoadChildNodes()...
private void LoadChildNodes(RadTreeNode node) |
{ |
switch (node.Attributes[_nodeType]) |
{ |
case _nodeTypeCategory: |
#region // load all questions in the current category |
foreach (Question currQuestion in QuestionService.Instance.GetByCategory(new Guid(SurveyID), new Guid(node.Value))) |
{ |
RadTreeNode childNode = new RadTreeNode(); |
childNode.Text = currQuestion.Label; |
childNode.Value = currQuestion.Id.ToString(); |
childNode.Attributes.Add(_nodeType, _nodeTypeQuestion); |
node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack; |
node.Nodes.Add(childNode); |
} |
#endregion |
break; |
The child nodes are display properly, but DO NOT have the expand button.
Any thoughts?
Thanks for the help!
0
Anthony
Top achievements
Rank 1
answered on 17 Jul 2008, 03:55 PM
Looks like I just had an error in my code! I was setting the ExpandMode on the wrong node! This can be seen in my code samples above!
Thanks for the help!
Thanks for the help!