get value of selected child node in rad treeview

4 posts, 0 answers
  1. Swapnil
    Swapnil avatar
    96 posts
    Member since:
    Aug 2013

    Posted 09 Dec 2013 Link to this post

    i am having treeview, i want to get value of selected child node in rad treeview?
    Without using javascript.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 09 Dec 2013 Link to this post

    Hi Swapnil,

    Please have a look into the following code snippet to get the value of the selected child node.

    <telerik:RadTreeView ID="RadTreeView1" runat="server" OnNodeClick="RadTreeView1_NodeClick">
            <telerik:RadTreeNode Text="Node1" runat="server">
                    <telerik:RadTreeNode Text="Node1.1" runat="server" Value="N1.1">
                    <telerik:RadTreeNode Text="Node1.2" runat="server" Value="N1.2">
            <telerik:RadTreeNode Text="Node2" runat="server">
                    <telerik:RadTreeNode Text="Node2.1" runat="server" Value="N2.1">
                    <telerik:RadTreeNode Text="Node2.2" runat="server" Value="N2.1">

    protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
        if (e.Node.Level != 0)
            // value of the selected child node
            string text = e.Node.Value;

  3. Telerik UI for ASP.NET Core is out
  4. Gopi
    Gopi avatar
    15 posts
    Member since:
    Jan 2013

    Posted 19 Jan 2015 in reply to Princy Link to this post

    its not working i am getting the text value empty
  5. Ivan Danchev
    Ivan Danchev avatar
    788 posts

    Posted 20 Jan 2015 Link to this post


    If you want to get the text value of the child node you have to modify slightly the code Princy posted:

    string text = e.Node.Text;

    Ivan Danchev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top