在RDLC嵌套列表对象绑定对象数据源

问题描述:

我知道我们可以对象数据源绑定到RDLC。我想绑定的对象一样如下:

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;}
}

虽然设置为RDLC,它会发现一次只能有一个数据集,说ContactReportData (无接触的清单)或联系人。我想这是因为报表需要它是那样

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.

我想要的是有报告显示的数据:
ContactReportHeading
ContactReportSubHeading
表格在联系人的形式 - 联系人姓名,名称

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.

我通过解决这个我对象retun作为具有接触的所有属性以及父对象的附加属性匿名对象的平面列表。然后在RDLC报告,增加了一个表,并结合接触对象的属性,然后加入一组到父属性。

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.