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

How to add a node under a specific node ?

1 Answer 83 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Manoj
Top achievements
Rank 1
Manoj asked on 12 Jan 2009, 10:47 AM
Hi Team,
    How to add a node under a specific node ?
    Also tell me how to export the tree view data into a excel sheet .

Regards
Manoj

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Jan 2009, 08:19 AM
Hello Manoj,

Please try the folowing code snippet to create a new node under a specific node.

CS:
protected void Button1_Click(object sender, EventArgs e) 
    RadTreeNode newNode = new RadTreeNode(); 
    newNode.Text = "New Node"
    RadTreeView1.FindNodeByText("Child RadTreeNode 1").Nodes.Add(newNode); 

ASPX:
<telerik:RadTreeView ID="RadTreeView1" Runat="server"
    <Nodes> 
        <telerik:RadTreeNode runat="server" Text="Root RadTreeNode1"
            <Nodes> 
                <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1"
                </telerik:RadTreeNode> 
                <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 2"
                </telerik:RadTreeNode> 
            </Nodes> 
        </telerik:RadTreeNode> 
        <telerik:RadTreeNode runat="server" Text="Root RadTreeNode2"
        </telerik:RadTreeNode> 
        <telerik:RadTreeNode runat="server" Text="Root RadTreeNode3"
        </telerik:RadTreeNode> 
    </Nodes> 
</telerik:RadTreeView> 

Thanks,
Shinu.


Tags
TreeView
Asked by
Manoj
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or