【发布时间】:2015-03-20 23:16:55
【问题描述】:
我想用同一个子报表来显示不同的数据。
我已尝试创建类列表(针对该子报告)并在子报告处理方法中将每个项目分配给一个子报告,是的,我可以做到,但每个子报告仅显示第一个子报告显示的数据。
但是我已经调试了代码,我发现实际上我为每个子报告发送了不同的数据源,但它们都显示相同的东西,
private static int index = 0;
public void LocalReport_SubreportProcessing(object sender, Microsoft.Reporting.WinForms.SubreportProcessingEventArgs e)
{
var mainSource =
(((Microsoft.Reporting.WinForms.LocalReport) sender).DataSources["DataSet"]).Value as BindingSource;
if (mainSource == null) return;
switch (e.ReportPath)
{
case "FeedbackBar":
{
var List = mainSource.DataSource as List<Classes.Feedback>;
if (List != null)
{
var lst = List[index++].List as B[];
e.DataSources.Add(new ReportDataSource("DataSet", lst));
}
}
break;
}
}
【问题讨论】:
标签: c# winforms reporting rdlc subreport