Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SubreportProcessing Event not Firing

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.

like image 990
Mairead Avatar asked Oct 29 '25 03:10

Mairead


2 Answers

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 :))

like image 164
picrap Avatar answered Oct 31 '25 16:10

picrap


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.

like image 27
Rocco Avatar answered Oct 31 '25 17:10

Rocco



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!