SubreportProcessing not firing
I have a WinForms solution that displays a report in the ReportViewer. I like what I've been able to do with this new control.
I have had a problem with the LocalReport.SubreportProcessing event not firing. Another post in this forum discussed this problem and suggested it occurs when the main report and subreport are found in a project that's not the executable. Is this a known issue, and if not, do you have a suggestion?
Thank You,
Nate
I am not aware of any bugs that would cause the SubreportProcessing event not to fire. The two most common reasons that this event would not fire are:
1. The subreport definition is not available. If you loaded the main report from a path or as an embedded resource, the viewer will look in the same location for the subreport. If you loaded the main report from a stream, you will need to load the subreport from a stream by calling LoadSubreportDefinition().
2. If you call ReportViewer.Reset(), you get new LocalReport and ServerReport objects. The SubreportProcessing event is on LocalReport, so you will need to wire up to it again.
I had this same issue using server reports (.RDL) in the Winforms
ReportViewer control. The problem appears to be that the subreports are
expected to have a local report file extension (.RDLC).
So when your subreports have a .RDL extension and not a .RDLC
extension, the ReportViewer control cannot find them. And the
SubReportProcessing event only seems to fire AFTER it has found the
subreport, therefore it never fires.
One solution is to rename your subreports to have a .RDLC extension.
For Example:
If you have a folder with the following server reports, then it will not fire the SubReportProcessing event.
Mainreport.RDL
Subreport1.RDL
Subreport2.RDL
To make the SubReportProcessing fire, rename the subreports:
Mainreport.RDL
Subreport1.RDLC
Subreport2.RDLC
It appears one cannot specify the file extension of the subreports in the main report.