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

Populating treeview control with multiple lists

4 Answers 142 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 04 Apr 2016, 04:48 PM

I am trying to create a treeview with hierarchical structure.

CIK

|__Series

      |__Class 

Series will be populated from the database based on the currently selected CIK value member(Id). Class will be populated from the database based on the Series ID selected. 

I couldn't find the right sample in the documentation to do this. Please point me in the right direction. Thank you for your help. 

4 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Apr 2016, 12:36 PM
Hello Frank,

Thank you for writing.

RadTreeView has the ability to bind to related data of custom objects which have member collections of related objects (ORM generated classes for example). You can refer to the following help article: http://docs.telerik.com/devtools/winforms/treeview/data-binding/binding-to-object-relational-data

Alternatively, you can use the load on demand feature which helps reduce performance and memory costs incurred when all nodes are loaded at one time. Additional information is available here: http://docs.telerik.com/devtools/winforms/treeview/data-binding/load-on-demand

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Frank
Top achievements
Rank 1
answered on 05 Apr 2016, 12:57 PM

Thank you for your reply Dess.I have gone through that documentation. But i am still puzzled on how to apply it for my scenario.

radTreeView1.DataSource = ckDao.GetCikListFromFileId(fileId);
radTreeView1.DisplayMember = "CikName";
radTreeView1.ValueMember = "CikId";

I was able to get parent level display correctly. But now to bring the list of children from the database i need the parent CikId to retrieve its children. I need to be able to call "GetSeriesListFromDatabase(cikId, fileId);" and set it as child member. and then invoke third level of data based on parent's series Id.

radTreeView1.ChildMember = sDao.GetSeriesListFromFileId(TxtJobNum.Text, ?? )

Thank you.

0
Frank
Top achievements
Rank 1
answered on 05 Apr 2016, 03:48 PM

Never mind. I just had to build my collection in data layer separately and then bind it to the tree control just like in the "binding to object relational document" data. I was able to get it to display all levels properly.

Thank you for pointing in the right direction.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Apr 2016, 08:20 AM
Hello Frank,

Thank you for writing back. 

If you have the whole data for the three data collections in advance, you can use the data binding approach demonstrated in the firstly referred help article from my previous post. However, it may be more suitable to use the load on demand approach. Thus, when a node is expanded you can extract the relevant child nodes considering the parent node's id.

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

Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
Treeview
Asked by
Frank
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Frank
Top achievements
Rank 1
Share this question
or