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

ServerSideCallBack & ExpandDepth

1 Answer 45 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
richard
Top achievements
Rank 1
richard asked on 21 Dec 2011, 09:47 PM
Hi,

I am using ServerSideCallBack and would like nodes to be expanded to say two levels.
Is there a way I can emulate the asp TreeView ExpandDepth property on load.

I have tried setting node.Expanded but this doesn't seem to trigger the populate on demand.

Many thanks

Richard

1 Answer, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 23 Dec 2011, 01:17 PM
Hello Richard,

You can check the level of the node you are expanding in the NodeExpand event. Then based on the level you can choose whether to add child items or not. Here is a small example:

protected void RadTreeView1_NodeExpand(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
{
    if (e.Node.Level < 2)
    {
        RadTreeNode node = new RadTreeNode();
        node.Text = "child";
        node.Value = "value";
        node.ExpandMode = TreeNodeExpandMode.ServerSideCallBack;
        e.Node.Nodes.Add(node);
    }
}


Regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
TreeView
Asked by
richard
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Share this question
or