DataSourceManager.GetDataSourceAssignablesByDataSource(XtraReport, Object, Boolean) Method
Returns a report and its elements (subreports, controls, bands, parameters) to which the specified data source is assigned.
Namespace: DevExpress.XtraReports
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
public static IEnumerable<IDataSourceAssignable> GetDataSourceAssignablesByDataSource(
XtraReport report,
object dataSource,
bool includeSubReports = false
)
Parameters
Name | Type | Description |
---|---|---|
report | XtraReport | A report instance. |
dataSource | Object | A data source. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
includeSubReports | Boolean | False |
|
Returns
Type | Description |
---|---|
IEnumerable<IDataSourceAssignable> | A collection that includes the report and its elements. |
Example
The following code sample retrieves all report elements bound to the same data source as the report itself:
using DevExpress.XtraReports;
//...
var report = new XtraReport1();
var dataSourceAssignables = DataSourceManager.GetDataSourceAssignablesByDataSource(
report,
report.DataSource,
includeSubReports: true
);
foreach (var elements in dataSourceAssignables) {
// Process report elements here...
}
See Also