Need to catch Leaf node click event

4 posts, 0 answers
  1. Medac
    Medac avatar
    79 posts
    Member since:
    Sep 2008

    Posted 29 Oct 2009 Link to this post

    HI,

    I have a RadTreeView. I need to display list box on click of leaf node of the tree. Can anybody help me in this?

    Regards,
    Medac
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Oct 2009 Link to this post

    Hi Medac,

    Try the following code snippet to hide/show RadListBox based on clicked node has children or not.

    C#:
     
    protected void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) 
        if (e.Node.Nodes.Count == 0) // Checking whether leaf node or not
        { 
            RadListBox1.Visible = true
        } 
        else 
        { 
            RadListBox1.Visible = false
        } 

    -Shinu.
  3. Medac
    Medac avatar
    79 posts
    Member since:
    Sep 2008

    Posted 29 Oct 2009 Link to this post


    HI,

    It is working fine. Thanks.

    I need to traverse tree nodes. From leaf node to root node. How to traverse the radtree till the root node?

    Regards,
    Medac
  4. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Oct 2009 Link to this post

    Hi,

    Try the following code snippet,

    C#:
     
    protected void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) 
        RadTreeNode node = (RadTreeNode) e.Node; // Clicked node 
        while (node.ParentNode != null
        { 
            node = node.ParentNode;  
            Response.Write(node.Text); 
        } 

    Thanks,
    Princy.
Back to Top