Skip to main content

XtraReportBase.DataMember Property

Specifies the collection, list, or table in the object assigned to the DataSource property from which to retrieve the data.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v23.2.dll

NuGet Package: DevExpress.Reporting.Core


public string DataMember { get; set; }

Property Value

Type Default Description
String String.Empty

The name of the collection, list, or table in the data source.


The DataMember property specifies the collection/list in the object assigned to the report data source from which to retrieve the data.

As a general rule, when you bind a report to the database, you must specify the table name as the DataMember property value. A JSON source may have multiple data sets, all owned by the topmost root element. In this situation, you must specify the DataMember as the name of the JSON data set under the root node.

You can omit the DataMember property in some cases, such as when the object assigned to the DataSource property is a collection or list.

When you change the report data source, the DataMember property is reset, and you must explicitly specify the DataMember value. It is necessary when you use the DataSourceManager.ReplaceDataSource method to replace the data source bound to the report elements.

Review the following topics for more information:


The following code sample creates a new SqlDataSource, creates a report with the XRTable control at runtime, and binds the table to data:

Table Report in Code

using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Sql;
using DevExpress.XtraReports.UI;
// ...
private static XtraReport CreateReport()
    // Creates a new data source.
    SqlDataSource sqlDataSource = CreateSQLDataSource();

    // Creates a new report and assigns the data source.
    XtraReport report = new XtraReport();
    report.DataSource = sqlDataSource;
    report.DataMember = "selectQuery";

    // Creates a detail band and adds it to the report.
    DetailBand detailBand = new DetailBand();

    // Creates a table and adds it to the detail band.
    XRTable table = new XRTable();

    // Creates a row and adds the product name and product price cells to the row.

    XRTableRow row = new XRTableRow();

    XRTableCell productName = new XRTableCell();
    XRTableCell productPrice = new XRTableCell();


    // Binds the table cells to the data fields.
    productName.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "[ProductName]"));
    productPrice.ExpressionBindings.Add(new ExpressionBinding("BeforePrint", "Text", "[UnitPrice]"));

    // Adjust the table width.
    table.BeforePrint += Table_BeforePrint;

    return report;

private static void Table_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
    XtraReport report = (sender as XRTable).RootReport;
    (sender as XRTable).WidthF = report.PageWidth - report.Margins.Left - report.Margins.Right;
private static SqlDataSource CreateSQLDataSource()
    // Creates a data source. 
    SQLiteConnectionParameters connectionParameters = new SQLiteConnectionParameters("Data/nwind.db", "");
    SqlDataSource dataSource = new SqlDataSource(connectionParameters);

    // Creates a SELECT query.
    SelectQuery query = SelectQueryFluentBuilder

    // Adds the query to the collection and returns the data source. 
    return dataSource;

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataMember property.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.


See Also