Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
What should we select whicle configuring datasource in define parameters from options(None, Cookie,Control, QueryString, Form,Session, Profile, RouteData) while passing parameter from report to its subreport contained in it.

Pls Advise


I am selecting None and it gives me error


Data retrieval failed for the subreport, 'rptchildData', located at: C:\SSRS\VS2010Repor\SubReport.rdlc. Please check the log files for more information.

Their is no info in log files


Below is the code used


code behind

C#
protected void Page_Load(object sender, EventArgs e)
       {
           if(!Page.IsPostBack)
           {

           this.ReportViewer1.LocalReport.SubreportProcessing +=
           new SubreportProcessingEventHandler(SubreportProcessingEventHandler);



           ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource
                   ("dsSource", SqlDataSource1));

           }

       }

       void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
       {
           e.DataSources.Add(new ReportDataSource("dsVBSubReport", this.SqlDataSource2));
       }



aspx

XML
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
            Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
            WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Height="800px"
            Width="1000px">
            <LocalReport ReportPath="MainReport.rdlc" EnableExternalImages="True">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="dsMain" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>


XML
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="---select statement---">
            <SelectParameters>
                <asp:Parameter Name="Id" />
            </SelectParameters>
        </asp:SqlDataSource>




Here Id is parameter passed from main report to subreport

In design view of Main Report i have already passed parameter from main report to sub report.

Please Help
Posted
Updated 3-Feb-15 22:21pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900