locked
Error: Subreport could not be shown RRS feed

  • Question

  • I have a report that contains a subreport. 

    I have set up the SubreportProcessing event as follows:

    protected void ReportViewer_SubreportProcessing(Object sender, Microsoft.Reporting.WebForms.SubreportProcessingEventArgs e) {

    Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource();

    rds.Value = SubReportDataSource;

    rds.DataSourceId = SubReportDataSource.ID;

    rds.Name = "ReportPhysicianReferrals_ReportPhysicianReferrals";

    e.DataSources.Add(rds);

    SubReportDataSource.SelectParameters["PhysicianID"].DefaultValue = e.Parameters["ReferringPhysicianID"].Values[0].ToString();

    //e.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ReportPhysicianReferrals_ReportPhysicianReferrals", SubReportDataSource)); --doing it this way does not seem to work

    }

    I pass to the subreport a ReferringPhysicianID.

    My SubreportProcessing event fires and passes the correct parameters to the datasource.  The Datasource gets called.  But I still get the evil error "Error: Subreport could not be shown'.  Its almost like the subreport in not being bound to the datasource.

    • Moved by Martin Xie - MSFT Tuesday, June 17, 2008 6:17 AM Redirect to ASP.NET forums.
    Tuesday, June 10, 2008 9:37 PM

Answers