title: Pass parameters from main report to subreport in RDLC
body: <p>I have a web page that displays an RDLC report in a ReportViewer. For each record in the main report there is a subreport.</p>
  
  <p>I need to pass the data from 3 fields from each record in the main report as a parameter to the subreports stored procedure.</p>
  
  <p>the main report works but it just says</p>
  
  <blockquote>
    <p>Error: Subreport could not be shown</p>
  </blockquote>
  
  <p>I have all the parameters defined in both reports, and I'm handling the localReport_SubreportProcessing event</p>
  
  <p>C# Code</p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
  {       
      this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Refs_MainDs", SqlDs_RefsReportsMain));
      this.ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(localReport_SubreportProcessing);
  }
  void localReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
  {
      e.DataSources.Add(new ReportDataSource("Refs_SubDs", SqlDs_RefsReportsSub));
  }
  </code></pre>
  
  <p>ASP Code</p>
  
  <pre><code>&lt;rsweb:ReportViewer ID="ReportViewer1" runat="server" Height="800px" Width="100%" Font-Names="Verdana" Font-Size="8pt" BorderColor="#666666" 
      BorderStyle="Solid" BorderWidth="1px" AsyncRendering="False" ShowPrintButton="False" &gt;
  &lt;LocalReport ReportPath="Reports\EOD_Refs_MainReport.rdlc" &gt;
      &lt;DataSources&gt;
          &lt;rsweb:ReportDataSource DataSourceId="SqlDs_RefsReportsMain" Name="Refs_DataSource" /&gt;
          &lt;rsweb:ReportDataSource DataSourceId="SqlDs_RefsReportsSub" Name="Refs_DataSource" /&gt;
      &lt;/DataSources&gt;
  &lt;/LocalReport&gt;                             
  </code></pre>
  
  <p></p>
  
  <p>AND </p>
  
  <pre><code>&lt;asp:SqlDataSource ID="SqlDs_RefsReportsMain" runat="server" ConnectionString="&lt;%$ ConnectionStrings:AlphaConnectionString %&gt;" 
      SelectCommand="rpt_RefsReport_Main" SelectCommandType="StoredProcedure"&gt;
  &lt;SelectParameters&gt;
      &lt;asp:QueryStringParameter Name="RefsID" QueryStringField="RefsID" Type="String" /&gt;
  &lt;/SelectParameters&gt;
  </code></pre>
  
  <p> </p>