How to Bind This Nested Data in Grid

4 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 26 Aug 2010 Link to this post

    Hello,

    I'm setting up a prototype page, I was wondering if there is an easy way to bind nested details tables using the following data:

    var entries = new[]
    {
    new 
    AgencyName = "Health International",  
    AgencyAbbreviation = "HI",
    AgencyStatus = "Active",
    AgencyType = "Service",
    Programs = new[]
    {
    new { ProgramName = "New Beginnings", ProgramAbbreviation = "NB", ProgramStatus = "Active" },
    new { ProgramName = "Bright Start", ProgramAbbreviation = "BS", ProgramStatus = "Active" }
    }
    }
    };

    Do I have to tap into DetailsTableDataBind?

    Thanks.
  2. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 31 Aug 2010 Link to this post

    Hello Brian,

    I recommend that you use the Autogenerate hierarchy capability of the RadGrid to implement the desired functionality.

    I hope this helps.

    Sincerely yours,
    Mira
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 31 Aug 2010 Link to this post

    Hi,

    Thanks.  That example mentions datasets, and seems to infer it generates the hierarchy based on data relations.  All of the examples I've seen with classes mention tapping into detailstabledatabind, and then loading the children information there.  The interesting thing is; I'm using anonymous classes, which means I would need to use reflection... would be nice to be able to specify the parent property data source, rather than having to tap into the event... is that currently possible, or is there another way that I'm missing?

    Thanks.
  5. Mira
    Admin
    Mira avatar
    1124 posts

    Posted 03 Sep 2010 Link to this post

    Hello Brian,

    The grid expects its data source to be one of these bindable property types.
    To implement the desired functionality, I suggest  that you create a DataSet, insert the data into it and assign it to the grid.

    I hope this helps.

    Kind regards,
    Mira
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top