I am documenting this here because this is very difficult to find anywhere online.

When you are creating a report in Visual Studio, one of the options you have is to create a subreport. I tried to make one a year ago and gave up after failing to get it to run correctly. This time around though, I finally figured out what I was missing.

Here is what you need to do:
* create your report and subreport as you normally would.
* Add parameters to the subreport and make sure to pass those same parameters in the subreport control on the “master” report.
* Here is where I had problems. On your .aspx page add OnSubreportProcessing="ReportViewer1_SubreportProcessing" to <LocalReport>
* Then in your .aspx.cs file add the following method:

protected void ReportViewer1_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
 report_vw_ActionLogTableAdapter actionTA = new report_vw_ActionLogTableAdapter();
 DataSet ds = new DataSet();
 ReportDataSource dataSource = new ReportDataSource("CustomerService_ActionLog", ds.Tables[0]);

Replace __CustomerService_ActionLog__ and __actionTA.GetActionLogDataByServiceRequestID__ with your appropriate values.
There you have it!

Comments? Feedback? Leave a comment!



No responses yet

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.