Skip to main content
All docs
V23.2

DataSourceManager.GetDataSourceAssignables(XtraReport, Boolean) Method

Returns a report and its elements (subreports, controls, bands, parameters) to which a data source can be assigned.

Namespace: DevExpress.XtraReports

Assembly: DevExpress.XtraReports.v23.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public static IEnumerable<IDataSourceAssignable> GetDataSourceAssignables(
    XtraReport report,
    bool includeSubReports = false
)

Parameters

Name Type Description
report XtraReport

A report instance.

Optional Parameters

Name Type Default Description
includeSubReports Boolean False

true to include elements from subreports; otherwise, false.

Returns

Type Description
IEnumerable<IDataSourceAssignable>

A collection that includes the report and its elements.

Example

The following code sample shows how to do the following:

  1. Retrieve a report and its elements (subreports, controls, bands, parameters) to which a data source can be assigned.
  2. Replace a data source for each report chart (element of the XRChart type) with a new JSON data source.
using DevExpress.DataAccess.Json;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports;
//...

var report = new XtraReport1();

var dataSourceAssignables = DataSourceManager.GetDataSourceAssignables(
    report,
    includeSubReports: true
);

var jsonDataSource = new JsonDataSource() { /* ... */ };

foreach (var elem in dataSourceAssignables) {
    if (elem is XRChart) {
        DataSourceManager.ReplaceDataSource(report, elem.DataSource, jsonDataSource);
    }
}
See Also