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

How to Bind This Nested Data in Grid

3 Answers 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 26 Aug 2010, 01:40 PM
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.

3 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 31 Aug 2010, 02:31 PM
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
0
Brian Mains
Top achievements
Rank 1
answered on 31 Aug 2010, 05:20 PM
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.
0
Mira
Telerik team
answered on 03 Sep 2010, 09:29 AM
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
Tags
Grid
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Mira
Telerik team
Brian Mains
Top achievements
Rank 1
Share this question
or