- Create reports Main.rdlc and Sub1.rdlc, Sub2.rdlc, Main.rdlc will be the main report and Sub1.rdlc and Sub2.rdlc will be the subreports embedded into Main.rdlc,
- add two "Subreport" elements to the Main.rdlc, with each element's reportname field set to "Sub1.rdlc" and "Sub2.rdlc" respectively,
- create a winform and add a reportviewer to it, set the report for the reportviewer to be "Main.rdlc", name the reportviewer rpv
- open "View Code" on the winform, and in the constructor add "rpv.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);"
- add a method "void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)" to the winform code, now create two List<Object> for each subreport in the method, and add "e.DataSources.Add(new ReportDataSource("Accounting_Core_Purchase_MiscPurchaseLine", [List<Object>]));" for each subreport
Thursday, January 6, 2011
How to embed subreports in a RDL report
Labels:
.NET,
C#,
RDL Reporting
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment