Hi,
I’m trying to display some master-detail data on a report. I have designed two separate reports and linking the detail report to a sub report item in the detail section of the master report. But the detail report (for any master row) is always displaying the records related to the first master row. Code I’m using is similar to below. Can you please help solving this.
Thanks and regards,
Kushan
MasterReport masterReport = new MasterReport();
DataTable masterDataSource = getMasterDataSource();
Foreach(DataRow drM in masterDataSource.Rows)
{
FormatMasterRows(drM);
DataTable detailDataSource = getDetailDataSource(drM);
If(detailDataSource.RowCount > 0)
{
DetailReport detailReport = new DetailReport();
Foreach(DataRow drD in detailDataSource.Rows)
{
FormatDetailRows(drD);
}
detailReport.DataSource = detailDataSource;
masterReport.subReportItem1.ReportSource = detailReport;
masterReport.subReportItem1.ReportSource = true;
}
Else
{
masterReport.subReportItem1.ReportSource = false;
masterReport.detailSection.Height = masterReport.detailSection.Height - masterReport.subReportItem1.Height;
}
}
masterReport.DataSource = drM;
DisplayRepotViewer(masterReport);