This is a migrated thread and some comments may be shown as answers.

Multiple DataSource in one report

1 Answer 419 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Karthik Kantharaj
Top achievements
Rank 1
Karthik Kantharaj asked on 03 Oct 2013, 01:42 PM
Hi

I have one report with multiple Stored Procedure(return datatable) to bind
below is the code i have in aspx.cs page

Telerik.Reporting.ObjectDataSource objectDataSource = new Telerik.Reporting.ObjectDataSource();
            objectDataSource.DataSource =  //How to bind all datatable from aspx.cs page to my Reporttab class

            // Creating a new report
            ReportTab report = new ReportTab ();

            // 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;

            // Assigning the report to the report viewer.
            ReportViewer1.ReportSource = reportSource;

If there is any online sample it will be great for people like me
Please Guide me

Karthik.K

1 Answer, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 08 Oct 2013, 10:16 AM
Hi Karthik,

Only one DataSource per report is allowed, so you can use only a single DataTable. If you have multiple DataSources, you should use data items (Table/Crosstab/List). Each data item has its own DataSource. 
To set the DataSource to a table, for example, you can use the following code:
 
var report = new Report1();
var crosstab = ((Crosstab)report.Items.Find("crosstab1", true)[0]);
crosstab.DataSource = ...
 
Regards,
Elian
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

Tags
General Discussions
Asked by
Karthik Kantharaj
Top achievements
Rank 1
Answers by
Elian
Telerik team
Share this question
or