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

Binding Telerik.Reporting.Table to System.Data.DataTable

2 Answers 1218 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 28 Mar 2017, 02:27 PM

I want to build a System.Data.DataTable in my report code to display some quick summary data. I would like to bind the System.Data.DataTable to a Telerik.Reporting.Table and have the columns and rows automatically generated, but I can not figure out how to get it to work.

I keep finding bits and pieces of code, but nothing that shows me what I need to do from end to end. For example, http://docs.telerik.com/reporting/object-data-source-how-to-bind-to-data-table shows a way of doing the binding, but does not indicate what needs to be done on the design side so it is not working for me.

Does anyone have a quick (and full) example that will point me in the right direction?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 29 Mar 2017, 02:38 PM
Hello Richard,

Example provided in How to: Bind to a DataTable demonstrates how to create an ObjectDataSource and set report's DataSource property at runtime.
If you need to set the data source for the Table item you can use Report.Items.Find method to get the inner items, for example:
var table = report.Items.Find("table1", true)[0] as Telerik.Reporting.Table;
table.DataSource = objectDataSource;
The attached project demonstrates the approach.

If you want to bind the DataTable at design-time you need to add ObjectDataSource component from Telerik Reporting toolbox items in Report Designer which will start the Wizard.
ObjectDataSource.DataSource would be the assembly qualified name or Type of the data access layer (class), where the reporting engine will use System.Reflection to create the instance of the class (by using its default constructor) and to execute its method specified by the ObjectDataSource.DataMember.

More detailed information can be found in ObjectDataSource Component help article.


Regards,
Katia
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Raul
Top achievements
Rank 1
answered on 15 Aug 2018, 04:51 PM
Katia, this work for Angular ? I want to binding a array to a table in my report, I have not idea how do that.
Tags
General Discussions
Asked by
Richard
Top achievements
Rank 1
Answers by
Katia
Telerik team
Raul
Top achievements
Rank 1
Share this question
or