Hi, I'm very new to Telerik Reporting so please excuse the very basic question :)
I have a solution with multiple projects. The reports are in their own project. I am trying to create the report from the website project and send a list of my data type to the objectDataSource of the report so that it can dynamically populate the report table. Then I render the report instance as a pdf to store.
I am able to call and create the report, but I am having trouble getting the report to populate any data into the table. The report renders but is blank other than the table headers.
I am trying to find an example solution that does this using 2 projects, a telerik report, an object data source, and a GetData method that takes in a List<MyData> and returns the List<StuffData> so that the table can be populated. Is this doable or is there a better way to pass a list of data to the report so that it can dynamically populate the table on the report?
Telerik.Reporting.ObjectDataSource objectDataSource1 = new Telerik.Reporting.ObjectDataSource();
List<StuffData> stuffDataList = new List<StuffData>();
//This is just an example. The list will be populated from user selections adding to the list.
for (int i = 1; i < 3; i++)
{
int dummyNumber = 999999999 - i;
StuffData stuffData = new StuffData()
{
stuffAddress = i + "Main Street",
stuffDataId = i,
stuffSource = "Source " + i,
stuffName = "Big Corp #" + i,
stuffNumber = dummyNumber.ToString()
};
stuffDataList.Add(stuffData );
}
//Class in the report project that contains the GetStuffData method to return the list of stuff. I couldn't find a way to pass a List<StuffData> in as a report
//parameter
objectDataSource1.DataSource = typeof(StuffDataAccess);
objectDataSource1.DataMember = "GetStuffData";
objectDataSource1.Parameters.Add(new Telerik.Reporting.ObjectDataSourceParameter("stuffDataList", typeof(List<StuffData>), stuffDataList));
ReportTemplate.StuffReviewReport stuffReviewReport =
new ScheduledHearingTemplate.StuffReviewReport();
stuffReviewReport.DataSource = objectDataSource1;
ReportProcessor reportProcessor = new ReportProcessor();
Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = stuffReviewReport;
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
Thanks in advance.