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

RadTreeView Next and Previous buttons

2 Answers 76 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ted
Top achievements
Rank 1
Ted asked on 29 Aug 2011, 04:45 PM
what is the best way to implement a Previous and Next button for a Load on demand treeview?  bascially I have a treeview on the left hand side of the screen that when a node is clicked it loads on the right hand side of the tree.  basically the way you do in your documentation.  http://www.telerik.com/help/aspnet/treeview/tree_loadondemand.html

they just want a forward and previous button on the right hand side to move up and down the tree that way. 

2 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 31 Aug 2011, 05:43 PM
Hello Ted,

If I understand you correct, you need a button to help you expand the RadTreeview when using LoadOnDemand. Please find below a sample code that I added to the demo. It affects the ServerSide tree and expands the selected node:

<telerik:RadButton ID="RadButton1" runat="server" onclick="RadButton1_Click" Text="Expand selected node">

protected void RadButton1_Click(object sender, EventArgs e)
    {
        RadTreeNode selecetdNode = RadTreeView2.SelectedNode;
        if (selecetdNode.Nodes.Count == 0)
        {
            DataTable data = GetChildNodes(selecetdNode.Value);
 
            foreach (DataRow row in data.Rows)
            {
                RadTreeNode node = new RadTreeNode();
                node.Text = row["Title"].ToString();
                node.Value = row["CategoryId"].ToString();
                if (Convert.ToInt32(row["ChildrenCount"]) > 0)
                {
                    node.ExpandMode = TreeNodeExpandMode.ServerSide;
                }
                selecetdNode.Nodes.Add(node);
            }
 
            selecetdNode.Expanded = true;
        }
    }

Hope this helps.

Kind regards,
Plamen Zdravkov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
chau minh tuan
Top achievements
Rank 1
answered on 29 Dec 2011, 05:44 AM
I also encountered similar cases 
Tags
TreeView
Asked by
Ted
Top achievements
Rank 1
Answers by
Plamen
Telerik team
chau minh tuan
Top achievements
Rank 1
Share this question
or