corelibraries-devexpress-dot-dataaccess-dot-objectbinding-dot-objectdatasource-1e496d88.md
Specifies the data member of an object data source.
Namespace : DevExpress.DataAccess.ObjectBinding
Assembly : DevExpress.DataAccess.v25.2.dll
NuGet Package : DevExpress.DataAccess
[DefaultValue(null)]
public string DataMember { get; set; }
<DefaultValue(Nothing)>
Public Property DataMember As String
| Type | Default | Description |
|---|---|---|
| String | null |
A String value, specifying the data member.
|
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
objds.BeginUpdate();
objds.DataMember = "Items";
objds.DataSource = typeof(BusinessObject);
asp-net-web-forms-dashboard-localization/CS/DashboardLocalizationManualWeb/Default.aspx.cs#L15
objDataSource.DataMember = "GetSalesData";
dataSourceStorage.RegisterDataSource("objectDataSource", objDataSource.SaveToXml());
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
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
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
objds.BeginUpdate()
objds.DataMember = "Items"
objds.DataSource = GetType(BusinessObject)
mvc-dashboard-custom-storage/VB/MVCDashboardDesigner/App_Start/DashboardConfig.vb#L18
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
objectDataSource.DataSource = GetType(EmployeeDataSource)
objectDataSource.DataMember = "GetEmployeeList"
objectDataSource.Constructor = New ObjectConstructorInfo()
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
objectDataSource.DataSource = GetType(Data)
objectDataSource.DataMember = "CreateData"
dashboard.DataSources.Add(objectDataSource)
See Also