views:

551

answers:

2

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.

A: 

I had the same problem, using the LocalReport without using the ReportViewer in a WPF application.

But it turned out, that I was trying to pass a null value as a parameter from the parent report into the subreport.

The subreport therefore never started rendering. That was the reason that the event was not fired.

jbandi
A: 

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

picrap