Grouped Binding

4 posts, 0 answers
  1. Mike
    Mike avatar
    59 posts
    Member since:
    Jan 2008

    Posted 06 May 2009 Link to this post

    Hello,

    This is probably embarrassingly simple, but I haven't been able to work it out... I've got some data that look like this:

    Group        ItemID        ParentID
    Things         1                0
    Things         2                0          
    Things         3                2
    Stuff             4                0
    Stuff             5                4

    I get that I can put it in a treeview using the standard binding properties with itemID and parentID... but I want to have the group as the first level thing.

    I've done this in code using a big/silly/messy procedure, and that works, but it's slower than I'd like, and it sometimes times out when the treeview is rendering.

    So yeah - is it possible to create the 3 levels with that kind of data?

    Thanks,

    Mike

  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 06 May 2009 Link to this post

    Hello Mike,

    Can you please explain in more detail how do you want your treeview to look like?
    Is it something like this?

    Things
           |- 1
                |- 0
    Things
           |- 2
                |- 0
    Stuff
           |- 4
                |- 0
    Stuff
           |- 5
                |- 4


    Kind regards,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Mike
    Mike avatar
    59 posts
    Member since:
    Jan 2008

    Posted 06 May 2009 Link to this post

    Hello,

    Close - the key is that I want "things" and "stuff" to be grouped... It ideally should look like this:

    -Things
       -1
       -2
            -3
    -Stuff
        -4
             -5

    Is that possible to do at all? The key would be basically making the top level a group and then doing a normal tree underneath those...

    Thanks,

    Mike

  4. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 11 May 2009 Link to this post

    Hello Mike,

    Well, you need to manually iterate through your data and create the RadTreeNode objects and hierarchy. You might use the DataRelation class.

    Kind regards,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top