Click here to Skip to main content
Rate this: bad
good
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 12:56pm
Comments
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
good
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);
then
void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
    {
        String param= e.Parameters[0].Values[0];
 
        ReportDataSource datasource = new ReportDataSource("subrptdatasourcename",subrptdatasource);
        e.DataSources.Add(datasource);
    }
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 5,130
1 DamithSL 4,237
2 Maciej Los 3,700
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,846


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 26 Jun 2012
Copyright © CodeProject, 1999-2014
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