This is a migrated thread and some comments may be shown as answers.

Get ChildID Or ParentID In RadTreeview

2 Answers 155 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
mrf
Top achievements
Rank 1
Iron
mrf asked on 22 Apr 2019, 06:25 AM

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 Answers, 1 is accepted

Sort by
0
mrf
Top achievements
Rank 1
Iron
answered on 22 Apr 2019, 09:50 AM

i found answer

add this line
trwFormName.ValueMember = "ChildID";

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Apr 2019, 11:15 AM
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.
Tags
Treeview
Asked by
mrf
Top achievements
Rank 1
Iron
Answers by
mrf
Top achievements
Rank 1
Iron
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or