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

3 posts, 0 answers
  1. Richard
    Richard avatar
    35 posts
    Member since:
    Jun 2009

    Posted 28 Mar 2017 Link to this post

    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. Katia
    Admin
    Katia avatar
    693 posts

    Posted 29 Mar 2017 Link to this post

    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
  3. Raul
    Raul avatar
    11 posts
    Member since:
    Aug 2017

    Posted 15 Aug in reply to Katia Link to this post

    Katia, this work for Angular ? I want to binding a array to a table in my report, I have not idea how do that.
Back to Top