Category / Section
How to find the child nodes of the selected node?
1 min read
The code snippet shown below illustrates how to find the selected node's child nodes.
C#
private void TreeView1_NodeSelected(object sender, Syncfusion.Web.UI.WebControls.Tools.Trees.TreeViewNodeEventArgs e)
{
string str="";
foreach(TreeViewNode tnode in e.Node.Items)
str+=tnode.Text+",";
Response.Write(str);
}
VB
Private Sub TreeView1_NodeSelected(ByVal sender As Object, ByVal e As Syncfusion.Web.UI.WebControls.Tools.Trees.TreeViewNodeEventArgs)
Dim str As String=""
For Each tnode As TreeViewNode In e.Node.Items
str+=tnode.Text+","
Next tnode
Response.Write(str)
End Sub
Note: Make sure that the AutoPostBackOnNodeSelect property is set to true