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

Immediate children in a tree view.

1 Answer 89 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Nen
Top achievements
Rank 1
Nen asked on 21 Oct 2010, 11:18 AM
Hi all,

how do i find the immdiate children of a parent node???, is this supported by telerik?

Thanks
-Nen

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Oct 2010, 12:44 PM
Hello Nen,

Try the following code snippet to access first child node of a parent node .

ASPX:
<telerik:RadTreeView ID="RadTreeView1" runat="server">
           <Nodes>
               <telerik:RadTreeNode Text="Books">
                   <Nodes>
                       <telerik:RadTreeNode Text="Arts" Expanded="false">
                           <Nodes>
                               <telerik:RadTreeNode Text="Children's Music" />
                               <telerik:RadTreeNode Text="Classical" />
                           </Nodes>
                       </telerik:RadTreeNode>
                       <telerik:RadTreeNode Text="Biographies" />
                   </Nodes>
               </telerik:RadTreeNode>
           </Nodes>
       </telerik:RadTreeView>

C#:
RadTreeNode node = RadTreeView1.FindNodeByText("Books"); // access parent node
RadTreeNode childNode = node.Nodes[0];// access first child node


Otherwise, use the following code:

    RadTreeView1.Nodes[0].Nodes[0].Text


-Shinu.
Tags
TreeView
Asked by
Nen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or