Back to Devexpress

Bind a Report to a List Object at Design Time and Supply Data at Runtime

xtrareports-7547-feature-guide-to-devexpress-reports-bind-reports-to-data-business-object-bind-a-report-to-a-list-object-at-design-time-and-supply-data-at-runtime.md

latest2.6 KB
Original Source

Bind a Report to a List Object at Design Time and Supply Data at Runtime

  • Feb 18, 2026
  • 4 minutes to read

This tutorial uses an object data source to bind a report to a List<T> object.

  1. Create a new application or open an existing application. For more information, review the following help topic: Get Started with DevExpress Reporting.

  2. Add a new blank report to it.

  3. Add a new Data.cs file with the following code to the application:

  4. Rebuild the solution.

  5. Invoke the Data Source Wizard and follow the Wizard’s steps to bind the report to the Data object.

  6. Drop data fields from the Field List onto the report.

  7. Handle the Form1_Load event to populate and assign the report’s data source.

Run the application and view the result.

Tips and Limitations

A direct assignment of the List<Data> property to the report’s DataSource property at runtime is not recommended because the List<Data> object may be disposed of at some stages of document generation, such as when report parameters are applied.

Use the ObjectDataSource class as the data source and the DataSourceManager class to assign a data source to your report at runtime. Once you bind a report to an object schema, you can access an instance of the ObjectDataSource class and assign the desired data model to that instance. The schema of the assigned model must be equal to the schema of the object to which the report was bound in the Designer.

Note that you can use a model data source object when developing an application, and at runtime replace the model object with a working object.

See Also

Bind a Report to an Object Data Source

Bind a Report to a Data Source Schema