Progress® Telerik® Reporting R2 2019

ObjectDataSource Component

A common application design practice is to separate the presentation layer from business logic and encapsulate the business logic in business objects. These business objects form a layer between the presentation layer and the data tier, resulting in a multi-tier application architecture. The ObjectDataSource component supports the multi-tier architecture by providing a way for you to bind the Data Report Items to a middle-tier business object without extensive code. The ObjectDataSource component represents the middle-tier object (business object or any other class) and provides data retrieval capabilities.

Supported object types

Any of the following data sources can be assigned to the DataSource property of the ObjectDataSource component:

If the DataSource reference contains more than one table, you must set the DataMember property to a string that specifies the table to bind to. For example, if the DataSource is a DataSet or DataViewManager that contains three tables named Customers, Orders, and OrderDetails, you must specify the table to bind to. If the name of the DataMember (i.e. the table to bind to) is not specified, the first Table of the DataSet will be bound to the DataSource.

If the DataSource references a strongly typed array of objects (business objects) these objects must contain public properties.

In case the DataSource is a business object, the DataMember property specifies the name of the method which should be invoked to retrieve the data. If the DataMember property is not specified, the constructor of the type will be invoked. If the constructor or the method contains arguments they can be specified through the Parameters collection of the ObjectDataSource component.

You can also bind to an ArrayList. A feature of the ArrayList is that it can contain objects of multiple types. The ObjectDataSource component binds to such a list despite the types of items in it. The only requirement is that they provide public properties with the same names as they are used in the expressions.

The purpose of the ObjectDataSource component is to provide data to data items in a declarative manner. The ObjectDataSource.DataSource property should be the assembly qualified name or the 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 property.

Already instantiated data objects do not have to be wrapped in a data source component. Instantiated data objects can be set directly to data items' DataSource properties.

Some Data Items (Graph, Map) will call the constructor or the data retrieval method of your business object during design-time. This is required in order to obtain the data, process it, and create a live preview of the data item. For this reason the business object used to feed the data item with data should be accessible during design-time, otherwise the data item will not be able to generate a live preview of the data.

Visual Studio is a 32-bit application, so the report designer is restricted to x86 mode even on x64 platforms, which prevents the ObjectDataSource Wizard from discovering any types from x64 assemblies. The solution is to use different platform configurations: for "Debug" builds it is best to use "Any CPU", while for "Release" builds you can use "x64" instead.


For security reasons the ObjectDataSource can resolve only types that are declared either in the current report's assembly or in AssemblyReferences element nodes in Telerik.Reporting section of application configuration file. During report processing, the ObjectDataSource component tries to resolve its type and if it is not listed in these two places, an exception will be thrown. In this case the application configuration file needs to be modified and the name of the assembly needs to be added in a new node within the AssemblyReferences element contents in the following manner:

<?xml version="1.0"?>
        <section name="Telerik.Reporting" type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting" allowLocation="true" allowDefinition="Everywhere" />
        <add name="yourAssemblyName"/>

The additional attributes like version, culture and publicKeyToken are not mandatory, because the .NET runtime can resolve the assembly only by its name.

After modifying the configuration file the application needs to be restarted so the new configuration settings will be read again.

See Also

In this article
Not finding the help you need?