Pass parameters from main report to subreport in RDLC

akilis

New Member
I have a web page that displays an RDLC report in a ReportViewer. For each record in the main report there is a subreport.I need to pass the data from 3 fields from each record in the main report as a parameter to the subreports stored procedure.the main report works but it just says\[quote\] Error: Subreport could not be shown\[/quote\]I have all the parameters defined in both reports, and I'm handling the localReport_SubreportProcessing eventC# Code\[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\]ASP Code\[code\]<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" ><LocalReport ReportPath="Reports\EOD_Refs_MainReport.rdlc" > <DataSources> <rsweb:ReportDataSource DataSourceId="SqlDs_RefsReportsMain" Name="Refs_DataSource" /> <rsweb:ReportDataSource DataSourceId="SqlDs_RefsReportsSub" Name="Refs_DataSource" /> </DataSources></LocalReport> \[/code\]AND \[code\]<asp:SqlDataSource ID="SqlDs_RefsReportsMain" runat="server" ConnectionString="<%$ ConnectionStrings:AlphaConnectionString %>" SelectCommand="rpt_RefsReport_Main" SelectCommandType="StoredProcedure"><SelectParameters> <asp:QueryStringParameter Name="RefsID" QueryStringField="RefsID" Type="String" /></SelectParameters>\[/code\]
 
Back
Top