This is a migrated thread and some comments may be shown as answers.
Binding telerik report with dataset
1 Answer 340 Views
This is a migrated thread and some comments may be shown as answers.
Chamara
Top achievements
Rank 1
Chamara asked on 18 Nov 2013, 03:00 AM
PLEASE REFER TO MY STACK OVERFLOW QUESTION FOR DETAILED EXPLANATION.

http://stackoverflow.com/questions/20039340/binding-data-to-a-telerik-report

I'm using ASP.NET MVC with telerik reporting. I'm trying to bind data to a dataset, which is assigned to a telerik report.

I have tried with below code but data is not showing up.

private void Report1_ItemDataBound(object sender, EventArgs e)
        {
            SqlDataAdapter adapter = new SqlDataAdapter();
            rep = new reportRepository();
            List<ReportViewModel> model = rep.GetData();

            // Creating and configuring the ObjectDataSource component:
            var objectDataSource = new Telerik.Reporting.ObjectDataSource();
            objectDataSource.DataSource = dsConvertion.ToDataSet(model); // GetData returns a DataSet with three tables
            objectDataSource.DataMember = "tblFirst"; /// Indicating the exact table to bind to. If the DataMember is not specified the first data table will be used.

            // Creating a new report
            Telerik.Reporting.Report report = new Telerik.Reporting.Report();

            // Assigning the ObjectDataSource component to the DataSource property of the report.
            report.DataSource = objectDataSource;

            // Use the InstanceReportSource to pass the report to the viewer for displaying
            Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
            reportSource.ReportDocument = report;

        }

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 20 Nov 2013, 02:32 PM
Hello,

First you have to set up your report definition with a report designer and then you can use ObjectDataSource wizard to set up the datasource.

For this task you may find useful the following help articles:

Regards,
Peter
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

Asked by
Chamara
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or