I'm using rdlc reports in WPF, so have done so using WindowsFormsHost wrapper. The rdlc report I'm looking for run has a subreport embedded in it, and I'm setting the data source of that using the SubreportProcessing event of the ReportViewer.
Viewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LoadAccessoriesSubReport);
My problem is that the SubreportProcessing event doesn't even get fired. I'm defining it in the Window_Loaded event of the WPF window which contains the embedded ReportViewer Control, see xaml below :
Title="ReportViewer" Height="1000" Loaded="Window_Loaded" Width="1000">
<Grid>
<WindowsFormsHost Name="winHost">
<wf:ReportViewer Dock="Fill" Name="rptViewer">
</wf:ReportViewer>
</WindowsFormsHost>
</Grid>
Would appreciate any help on this.
Check your subreport parameters. If a parameter condition fails, the subreport is not loaded. Also check Visual Studio trace output, it shows which parameter causes the error.
In order to perform a quick check, set all subreport parameters to allow null.
It did the trick for me (now, I just need to understand why I get a null value instead of the expected one :))
I had the same problem and found that the ReportViewer1.Reset() was clearing the event handler. Moving the AddHandler line to immediately after the ReportViewer1.Reset() solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With