Binding to self-referencing hierarchical data

2 posts, 1 answers
  1. Robert
    Robert avatar
    23 posts
    Member since:
    Jun 2012

    Posted 24 Jul 2012 Link to this post

    Good morning,

    in my application I have a lot of data coming from the corresponding webservice. The data objects represent a tree structure without a fixed depth, so it may look like this structure below:

    Group (arbitrary # of (sub)groups) -- Area -- City -- Office -- Department

    So the groups may contain several layers of subgroups of the same data type, the deeper order is fixed (Area->City->Office->Department). The objects do have a ParentIds property (a list), so one object can be a child of different parents.

    In your hierarchical data binding example the data structure has a fixed number of layers, could you provide me a little sample that binds to such data as described above from code behind? Thanks in advance!

  2. Answer
    Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 24 Jul 2012 Link to this post

    Hi Rob,

    This article can get you started on how to use the RadTreeView control to display a hierarchy build from a flat collection. . However, please note that this article is a basic sample and if you need to implement an add/remove or drag/drop functionality in the RadTreeView, you'll have to extend the self-referencing data implementation like demonstrated in the attached sample.

    Another useful resource is this forum thread that describes how to configure the entity model on the server to turn the flat colelction into a hierarchical collection and then display the hierarchy in the RadTreeView control.

    I hope this information will help you, but please let us know if we can further assist you.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top