Back to Devexpress

ObjectDataSource.DataMember Property

corelibraries-devexpress-dot-dataaccess-dot-objectbinding-dot-objectdatasource-1e496d88.md

latest7.0 KB
Original Source

ObjectDataSource.DataMember Property

Specifies the data member of an object data source.

Namespace : DevExpress.DataAccess.ObjectBinding

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
[DefaultValue(null)]
public string DataMember { get; set; }
vb
<DefaultValue(Nothing)>
Public Property DataMember As String

Property Value

TypeDefaultDescription
Stringnull

A String value, specifying the data member.

|

Remarks

To bind the ObjectDataSource to an object, leave this property set to null. In the Data Source wizard, this scenario corresponds to the following option: “Do not select a member, bind to the entire object”.

To bind the ObjectDataSource to a property or method, assign its name to the DataMember property. When binding to a method, it is also required to specify this method’s ObjectDataSource.Parameters.

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

Note

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.

data-access-library-create-data-sources-at-runtime/CS/ObjectDataSourceSnippets/Code.cs#L17

csharp
objds.BeginUpdate();
objds.DataMember = "Items";
objds.DataSource = typeof(BusinessObject);

asp-net-web-forms-dashboard-localization/CS/DashboardLocalizationManualWeb/Default.aspx.cs#L15

csharp
objDataSource.DataMember = "GetSalesData";
dataSourceStorage.RegisterDataSource("objectDataSource", objDataSource.SaveToXml());

javascript-dashboard-localization/CS/DashboardLocalizationManualHTMLJS/App_Start/DashboardConfig.cs#L18

csharp
DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("ObjectDataSource", typeof(ProductSales));
objDataSource.DataMember = "GetProductSales";
dataSourceStorage.RegisterDataSource("objectDataSource", objDataSource.SaveToXml());

asp-net-core-dashboard-localization/CS/DashboardLocalizationManualCore/Startup.cs#L35

csharp
DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("ObjectDataSource", typeof(ProductSales));
objDataSource.DataMember = "GetProductSales";
dataSourceStorage.RegisterDataSource("objectDataSource", objDataSource.SaveToXml());

asp-net-mvc-dashboard-localization/CS/DashboardLocalizationMVC/App_Start/DashboardConfig.cs#L18

csharp
DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("ObjectDataSource", typeof(ProductSales));
objDataSource.DataMember = "GetProductSales";
dataSourceStorage.RegisterDataSource("objectDataSource", objDataSource.SaveToXml());

data-access-library-create-data-sources-at-runtime/VB/ObjectDataSourceSnippets/Code.vb#L14

vb
objds.BeginUpdate()
objds.DataMember = "Items"
objds.DataSource = GetType(BusinessObject)

mvc-dashboard-custom-storage/VB/MVCDashboardDesigner/App_Start/DashboardConfig.vb#L18

vb
Dim objDataSource As New DashboardObjectDataSource("Object Data Source", GetType(SalesPersonData))
objDataSource.DataMember = "GetSalesData"
dataSourceStorage.RegisterDataSource("objectDataSource", objDataSource.SaveToXml())

reporting-winforms-parameter-dynamic-list/VB/Form1.vb#L21

vb
objectDataSource.DataSource = GetType(EmployeeDataSource)
objectDataSource.DataMember = "GetEmployeeList"
objectDataSource.Constructor = New ObjectConstructorInfo()

reporting-web-forms-object-data-source-constructor-parameters/VB/DXWebApplication1/DXWebApplication1/Default.aspx.vb#L60

vb
objds.Name = "ObjectDataSource1"
objds.DataMember = "Items"
objds.DataSource = GetType(DemoModel)

wpf-dashboard-how-to-bind-to-object-list/VB/WpfDashboard_ObjectDataSource/MainWindow.xaml.vb#L29

vb
objectDataSource.DataSource = GetType(Data)
objectDataSource.DataMember = "CreateData"
dashboard.DataSources.Add(objectDataSource)

See Also

ObjectDataSource Class

ObjectDataSource Members

DevExpress.DataAccess.ObjectBinding Namespace