Click here to Skip to main content
12,884,951 members (29,951 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# C#4.0 CrystalReports
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 19-Jun-12 11:56am
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can try this

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

void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
        String param= e.Parameters[0].Values[0];
        ReportDataSource datasource = new ReportDataSource("subrptdatasourcename",subrptdatasource);

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 26 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100