Populating treeview control with multiple lists

5 posts, 1 answers
  1. Frank
    Frank avatar
    86 posts
    Member since:
    Mar 2012

    Posted 04 Apr Link to this post

    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. 

  2. Answer
    Dess
    Admin
    Dess avatar
    1605 posts

    Posted 05 Apr Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Frank
    Frank avatar
    86 posts
    Member since:
    Mar 2012

    Posted 05 Apr in reply to Dess Link to this post

    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.

  5. Frank
    Frank avatar
    86 posts
    Member since:
    Mar 2012

    Posted 05 Apr Link to this post

    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.

  6. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 06 Apr Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready