Get ChildID Or ParentID In RadTreeview

3 posts, 0 answers
  1. mrf
    mrf avatar
    4 posts
    Member since:
    Aug 2018

    Posted 22 Apr 2019 Link to this post

    Hi
    i have a radtreeview with checkbox that fill with this table

    ChildID    ChildName    ParentID    ParentName
    1                     a
    2                      b                1                   a
    3                      c                2                   b

     

       trwFormName.DisplayMember = "ChildName";

       trwFormName.ParentMember = "ParentID";
       trwFormName.ChildMember = "ChildID";

    i take all node that checked by this code:

     foreach (var node in trwFormName.TreeViewElement.GetNodes())
                    {
                        if (node.Checked)
                        {
                            var t = node.Value;
                        }
                    }

    but i cant get node id . value is name and not id

    please help me

  2. mrf
    mrf avatar
    4 posts
    Member since:
    Aug 2018

    Posted 22 Apr 2019 Link to this post

    i found answer

    add this line
    trwFormName.ValueMember = "ChildID";

  3. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3954 posts

    Posted 22 Apr 2019 Link to this post

    Hello,     

    I am glad that the problem you were facing is now resolved. Additional information how to bind RadTreeView with data is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/treeview/data-binding/binding-to-object-relational-data

    Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top