I have a master report that has no datasource. It simply contains 2 subreports. I want to set the datasource for my subreports programatically from my web application. I need to do this because the datasources are web services which I'm converting to datasets. The code I have below is running but no data is shown on the report. When I debug and step through the code the subreports have the correct datasets as their datasouces. Any ideas on what I'm doing wrong? Do I need to do something to the main report before running it?
// get a reference to the master report
Telerik.Reporting.Report rptMain = new my_report();
// get a reference to the subreports
Telerik.Reporting.SubReport rptSub1 = (Telerik.Reporting.SubReport)rptMain.Items.Find("subReport1", true)[0];
Telerik.Reporting.SubReport rptSub2= (Telerik.Reporting.SubReport)rptMain.Items.Find("subReport2", true)[0];
// get the datasets for the subreports by converting xml from web service calls into datasets
DataSet ds1 = GetDataSetForSubReport1();
DataSet ds2 = GetDataSetForSubReport2();
// set the subreport datasources
rptSub1.ReportSource.DataSource = ds1;
rptSub2.ReportSource.DataSource = ds2;
// open the report as a pdf file
ReportProcessor reportProcessor = new ReportProcessor();
RenderingResult result = reportProcessor.RenderReport("PDF", rptMain, null);
...
// get a reference to the master report
Telerik.Reporting.Report rptMain = new my_report();
// get a reference to the subreports
Telerik.Reporting.SubReport rptSub1 = (Telerik.Reporting.SubReport)rptMain.Items.Find("subReport1", true)[0];
Telerik.Reporting.SubReport rptSub2= (Telerik.Reporting.SubReport)rptMain.Items.Find("subReport2", true)[0];
// get the datasets for the subreports by converting xml from web service calls into datasets
DataSet ds1 = GetDataSetForSubReport1();
DataSet ds2 = GetDataSetForSubReport2();
// set the subreport datasources
rptSub1.ReportSource.DataSource = ds1;
rptSub2.ReportSource.DataSource = ds2;
// open the report as a pdf file
ReportProcessor reportProcessor = new ReportProcessor();
RenderingResult result = reportProcessor.RenderReport("PDF", rptMain, null);
...