I know we can bind object data source to RDLC. I am trying to bind an object like as follows:
public class ContactReportData
{
public string ContactReportHeading{get;set;}
public string ContactReportSubHeading{get;set;}
public List<Contact> ContactDetails{get;set;}
}
public class Contact {
public string ContactName{get;set;}
public string ContactDesignation{get;set;}
}
While Setting to RDLC, it will find only one dataset at time, say ContactReportData (without the list of contact) OR Contact. I guess that is because the report needs it to be in that way.
What I want is to have the data shown in report as : ContactReportHeading ContactReportSubHeading tabular form of Contacts in - Contact Name, Designation.
I could have given this as the details of report data as static and only bind the contacts list, but what I have is list of contact reports where I a facing the issue.
I solved this by making my object retun as a flat list of anonymous object having all the properties of contact as well as the additional properties of parent object. Then in the RDLC report, added a table and bound the properties of contact object and then added a groups to the parent properties.
Summary is for making such layout you need to add grouping.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With