Quick Guide to Report Data Binding
- 3 minutes to read
This topic introduces the main concepts of binding reports to data.
- Data Binding Overview
- Supported Data Sources
- Binding to Multiple Data Sources
- Binding a Report without Loading Data at Design Time
Data Binding Overview
The XtraReportBase.DataSource and XtraReportBase.DataMember properties specify a report’s data binding.
Expanding the DataSource property editor and clicking Add Report Data Source runs the Data Source Wizard whose main features include:
- Support for a variety of popular data providers, including SQL, Entity Framework, Excel and object data sources;
- Visual editing of master-detail relations between data tables and views;
- A powerful Query Builder that enables you to shape report data.
After connecting a report to a data source, the available data fields become listed in the Field List, from where they can be dropped onto the report to create data-aware controls.
Tip
DevExpress Reports provide two different data binding modes: legacy bindings and expression bindings. See Data Binding Modes to learn about the available binding modes.
To reuse a data source in other reports, right-click it in the Field List or Report Explorer and add it to the Report Gallery.
To assign an existing data source to a report, select it under the Components section in the Report Gallery and click Add to Report Components.
Supported Data Sources
See the following documents to learn how to bind a report to specific data providers:
- Binding a Report to a Database
- Binding a Report to an Object Data Source
- Binding a Report to an Entity Framework Data Source
- Binding a Report Using Standard .NET Data Providers
- Binding a Report to a List Object
- Binding a Report to an Excel or CSV File
- Binding a Report to XML Data
Binding to Multiple Data Sources
A report can only have a single data source assigned to its XtraReportBase.DataSource property. However, you can assign a different data source to a subreport or detail report.
See the following tutorials to learn about using this approach:
Tip
See Merging Reports to learn how to merge pages of different reports into a single document.
You can bind the following report controls to individual data sources, independent of the actual report:
Binding a Report without Loading Data at Design Time
You can avoid loading actual data at design time while still being able to adjust the report’s layout and bind report controls to data fields. The real data is loaded at runtime when the report is generated.
Use one of the following approaches to accomplish this task, depending on which data source is assigned to your report: