私は RDLC レポートを使用しているプロジェクトに取り組んでいます。いくつかの会社情報を含むヘッダーとフッターにマスター レポートを使用したいのですが、それは異なるデータセットとバインドされ、レポートの本体内にレポートを表示するサブレポートがあります。このサブレポートには、さまざまなレポートのさまざまなデータセットが含まれています。
すべてが正常に機能していますが、サブレポートにさらにレコードがある場合、ページングに分割され、次のページをクリックすると機能せず、最初のページが再度表示されます。
Infacat テクニックを見逃しましたが、特定できません。
レポートをバインドする私のコードは次のとおりです。
private void LoadReport()
{
var objAccess = new DataAccess();
_dataSet = objAccess.CompanyGetAll();
var mainReport = new StreamReader(Server.MapPath("~/Reports/ComanyInfo.rdlc"));
ReportViewerTraineePayments.LocalReport.LoadReportDefinition(mainReport);
ReportViewerTraineePayments.LocalReport.DataSources.Clear();
ReportViewerTraineePayments.LocalReport.DataSources.Add(new ReportDataSource("DS_CompanyInfo", _dataSet.Tables[0]));
var subReport = new StreamReader(Server.MapPath(DynamicReportName));
ReportViewerTraineePayments.LocalReport.SubreportProcessing +=
new SubreportProcessingEventHandler(localReport_SubreportProcessing);
ReportViewerTraineePayments.LocalReport.LoadSubreportDefinition("Rpt_Content", subReport);
}
private void localReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
e.DataSources.Add(new ReportDataSource(DynamicDataSetName, DynamicReportDataSource.Tables[0]));
}