Click here to Skip to main content
15,896,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi ,
I am create a report and named it MainReport.rpt
i want to user this report for all application reports ,only the report body can change (some Header and Footer) , i put a subreport object int the main report and i need to load the report at runtime when i am use the MainReport.subreports[0].OpenSubreport(reportName) i get a error ,
please help me how i can load the desired report in the subreport object
Posted
Comments
ShaikhM 19-Jun-12 23:54pm    
please provide more detail. Whats the error. Also how have you linked the Main report and subreport. This is very little information to provide a solution.

1 solution

You can try this

create eventhandler at the time of main report loading
C#
ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);

then
C#
void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
    {
        String param= e.Parameters[0].Values[0];

        ReportDataSource datasource = new ReportDataSource("subrptdatasourcename",subrptdatasource);
        e.DataSources.Add(datasource);
    }
 
Share this answer
 
v2

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