Click here to Skip to main content
11,713,310 members (80,818 online)
Rate this: bad
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 at 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
0 CHill60 335
1 Sergey Alexandrovich Kryukov 290
2 OriginalGriff 200
3 Andy Lanng 165
4 Maciej Los 130
0 CHill60 335
1 Sergey Alexandrovich Kryukov 300
2 OriginalGriff 230
3 Andy Lanng 160
4 Maciej Los 130

Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 26 Jun 2012
Copyright © CodeProject, 1999-2015
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