Hi,
I have Telerik report designed in Telerik Report Designer.
It contains two object data sources.
I programmatically load trdp file and initialize DataSource property of Report object by two Object Data Source Instances.
In generated report I see strange behavior: table is bound to first data source is duplicated.
Questions:
1.Why report object contains DataSource property = null?
2.in the spec. it's written, that DataSource should be initialized by object derived from IEnumerable interface as well, but when report is rendered, it doesn't take all instances of passes Object Data Sources, but just duplicate first one.
Source code:
var reportPath = HttpContext.Current.Server.MapPath("~/Reports") + "/InvoiceAppendix2.trdp";using (var sourceStream = System.IO.File.OpenRead(reportPath)){ var report = (Report)reportPackager.UnpackageDocument(sourceStream); //prepare report parameters report.ReportParameters["SalesOrderId"].Value = salesOrderId; //init data source var dataSource1 = new ObjectDataSource(); dataSource1.DataSource = typeof(SalesOrderBDS); dataSource1.DataMember = "GetSalesOrders"; dataSource1.Name = "SalesOrderInfoBO"; dataSource1.Parameters.Add(new ObjectDataSourceParameter("salesOrderId", typeof(int), salesOrderId)); var dataSource2 = new ObjectDataSource(); dataSource2.DataSource = typeof(JobJacketBDS); dataSource2.DataMember = "GetJobJackets"; dataSource1.Name = "JobJacketInfoBO"; dataSource2.Parameters.Add(new ObjectDataSourceParameter("salesOrderId", typeof(int), salesOrderId)); report.DataSource = new ObjectDataSource[] { dataSource1, dataSource2 }; var reportProcessor = new ReportProcessor(); var instanceReportSource = new InstanceReportSource(); instanceReportSource.ReportDocument = report; var result = reportProcessor.RenderReport("PDF", instanceReportSource, null); var stream = new MemoryStream(result.DocumentBytes); return new Classes.FileResult(stream, "application/pdf", $"InvoiceAppendix_{salesOrderId}.pdf", true);}