Hi,
I am using Telerik Report Q3 2010 SP1 (4.2.10.1221).
I created a master report and would like to add several sub-reports to it at run time with different data sources.
With the follow code, it generates what I want: (see attached image: expected.png)
However, I need to get the headerId first before I can call AddSubRepots method, so I modified the code to such:
Please see attached image: wrong.png
The first two tables should contain 2 rows and the third one should contain 5 rows, but it only shows 2 in this case.
If I modified the order of my data source, show "Material" first, all tables display 5 rows.
Can someone help with explaining what's happening here?
Thanks,
VH
I am using Telerik Report Q3 2010 SP1 (4.2.10.1221).
I created a master report and would like to add several sub-reports to it at run time with different data sources.
With the follow code, it generates what I want: (see attached image: expected.png)
public MasterReport()
{
InitializeComponent();
AddSubreports(111);
}
private void AddSubreports(int headerId)
{
ReportDataSource c = new ReportDataSource(headerId);
dss = c.GetSources();
foreach (ParameterValuesReportDataSource ds in dss)
{
IndividualParameterReport subreport = new IndividualParameterReport(ds);
SubReport subReport = new SubReport();
subReport.Size = new SizeU(Telerik.Reporting.Drawing.Unit.Cm(8), Telerik.Reporting.Drawing.Unit.Cm(1));
subReport.Dock = DockStyle.Top;
subReport.ReportSource = subreport;
detail.Items.Insert(0, subReport);
}
}
However, I need to get the headerId first before I can call AddSubRepots method, so I modified the code to such:
public MasterReport()
{InitializeComponent();
DataSource = null;
NeedDataSource += new EventHandler(MasterReport_NeedDataSource);
}void MasterReport_NeedDataSource(object sender, EventArgs e)
{headerId = Int32.Parse(ReportParameters["ParameterHeaderId"].Value.ToString());
AddSubreports(headerId);
}The first two tables should contain 2 rows and the third one should contain 5 rows, but it only shows 2 in this case.
If I modified the order of my data source, show "Material" first, all tables display 5 rows.
Can someone help with explaining what's happening here?
Thanks,
VH