How do I fill a dataset in an SSRS subreport?

拥有回忆 提交于 2019-11-30 21:30:20

You need to use SubreportProcessing Event to set your data source. See following walkthrough also.

ReportViewer.LocalReport.SubreportProcessing +=
                new SubreportProcessingEventHandler(exampleSubreportProcessingEventHandler);

    void exampleSubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
    {
        e.DataSources.Add(new ReportDataSource("SubReportDataSet", GetSummaryRequestsDataSet()));
    }

From provided link SubreportProcessing Event.

The SubreportProcessing event is triggered for every instance of the subreport in the main report, and not just for each subreport definition. If a report contains multiple subreports instances from the same report definition, this event is triggered for each instance.

If the main report has several subreports, you can examine the ReportPath property of the SubreportProcessingEventArgs class to determine which subreport is being processed and supply data for that subreport.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!