SubReportProcessingEventHandler not firing in SharePoint Web Part Code RRS feed

  • Question

  • I've created a SP Web Part using Visual Studio 2008. My web part contains a ReportViewer object. The report has a subreport linked to the main report.

    When I run this webpart on SharePoint, the main report is shown, but I get "Error: Subreport could not be shown" at where the subreport is supposed to be. When I run with debugging, I realised that the method SubreportProcessing Event Handler is not fired.

    Can anyone help me on this?

    P/s: When I extract this web part out into a normal web application, everything works.

    For reference, this is my code:
    protected override void CreateChildControls() 
       ReportViewer ReportViewer1 = new ReportViewer();
       // set properties like width, height and rdlc file
       ReportViewer1.LocalReport.ExecuteReportInCurrentAppDomain( System.Reflection.Assembly.GetExecutingAssembly().Evidence);
       // for some reason this must be included
       ds = new dsProjects();      // my defined dataset
       FillData(ds);              // filling the dataset with data
       ReportDataSource rdSource = 
            new ReportDataSource("dsProjects_tblProjects");
       rdSoure.Value = ds.tblProjects;<br/>
       ReportViewer1.LocalReport.SubreportProcessing += 
    new SubreportProcessingEventHandler( ReportViewer1_SubReportProcessing);
    void ReportViewer1_SubReportProcessing(object
     sender, SubreportProcessingEventArgs e) 
       ReportDataSource rdSource = 
    new ReportDataSource("dsProjects_tblActivities");
       rdSource.Value = ds.tblActivities;
    Tuesday, September 1, 2009 5:54 AM