How do I fill a dataset in an SSRS subreport?

前端 未结 1 1657
无人共我
无人共我 2021-01-06 02:59

This seems like it should be trivial but I\'m having difficulties.

I have a main report, I have been filling datasets as follows in ReportViewer.aspx.cs.

1条回答
  •  一生所求
    2021-01-06 03:47

    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.

    0 讨论(0)
提交回复
热议问题