On event click how to get ChildMember value

3 posts, 1 answers
  1. Jeff
    Jeff avatar
    12 posts
    Member since:
    Oct 2016

    Posted 21 Jun 2018 Link to this post

    Hi everybody !

    I have a radTreeView controller binding by self referencing data from a  programmatically build DataTable..

    I define radtreeView ChildMember, ParentMember and DisplayMember properly, all looks fine.

    on select event click like mouseclick for instance, I easily can get DisplayMember value using e.Node.Name or e.Node.text,  but I need to get the ChildMember value, and I can't find any way to find It.

     

    A piece of help would be great !

    Thanks in advance !

     

    Jeff

  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3957 posts

    Posted 21 Jun 2018 Link to this post

    Hello, Jeff,   

    If you set the RadTreeView.ValueMember property to "id" for example, you can easily extract this value by getting the RadTreeNode.Value property. Thus, in the NodeMouseClick event you have access to the affected node by the RadTreeViewEventArgs.Node property: 

    public RadForm1()
    {
        InitializeComponent();
     
        this.radTreeView1.DisplayMember = "name";
        this.radTreeView1.ValueMember = "id";
        this.radTreeView1.ParentMember = "pid";
        this.radTreeView1.ChildMember = "id";
        this.radTreeView1.DataSource = this.GetSampleData();
     
        this.radTreeView1.NodeMouseClick+=radTreeView1_NodeMouseClick;
    }
     
    private void radTreeView1_NodeMouseClick(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e)
    {
        Console.WriteLine(e.Node.Value);
    }

    I hope this information helps. If you have any additional questions, please let me know. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Jeff
    Jeff avatar
    12 posts
    Member since:
    Oct 2016

    Posted 21 Jun 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Work like a charm !

    Million of thanks Dess

    That was so simple :) ! 

Back to Top