Search This Blog

Friday, October 24, 2014

Telerik Reporting Binding C# Example

Telerik > Reporting > ObjectDataSource

ObjectDataSource component represents the middle-tier object and provides data retrieval capabilities. 
Example


var ods = new Telerik.Reporting.ObjectDataSource();
ods.DataSource = GetData();
ods.DataMember = "Products"; //table to bind to        
Telerik.Reporting.Report report = new Telerik.Reporting.Report();
report.DataSource = ods;
Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
reportSource.ReportDocument = report;
reportViewer1.ReportSource = reportSource;
reportViewer1.RefreshReport();