Binding report with ObjectDataSource which is IEnumerable containing a IEnumerable property .

1 Answer 99 Views
.NET Core Binding
Brian
Top achievements
Rank 2
Brian asked on 29 Mar 2023, 06:08 AM

Hi Team,

I am trying to generate a report with below object datasource PopulationByAgeRange which is a list, and I am trying to bind DemographicData property to a table which is also a list.

public class PopulationByAgeRange
    {
        public IEnumerable<DemographicData> DemographicData { get; set; }
        public string LayerType { get; set; }
        public decimal LayerValue { get; set; }
        public uint CurrentYear { get; set; }
        public uint ForecastYear { get; set; }
        public string Logo { get; set; }
    }

If PopulationByAgeRange was a single object I could bind the table to  Fields.DemographicData but since PopulationByAgeRange is a list the table is not rendered with Fields.DemographicData. Could you please let me know how to bind the table when object datasource is a list.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 30 Mar 2023, 12:14 PM

Hello Brian,

Thank you for the attached report and the additional information!

In such a scenario, in order to use the DemographicData list, you would need to insert a nested data item whose DataSource can be bound to the DemographicData field as explained in the Using Parent DataItem Collection Property as Child DataItem DataSource - Telerik Reporting article.

For example, you may set the data source component to a list report item, and inside that list, you may insert a table whose DataSouce property is set via a binding to the Fields.DemographicData field. I have attached a sample report where that scenario is demonstrated with simpler data.

Please have a look at it and let me know if you have any further questions regarding it.

Regards,
Dimitar
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Tags
.NET Core Binding
Asked by
Brian
Top achievements
Rank 2
Answers by
Dimitar
Telerik team
Share this question
or