Binding to Data

  • 3 minutes to read

DevExpress data-aware controls are compatible with any data access technology (ADO.NET, Entity Framework, XPO, etc.) and capable to display data from any data source that implements the IList, IBindingList, or ITypedList interface. Refer to these help topics for more details: Traditional Data Binding Methods and Data Binding Common Concepts.

This topic provides a brief overview of methods that can be used to bind a vertical grid control (VGridControl or PropertyGridControl) to data.

TIP

DevExpress data-aware controls show data from their sources as is. If you need to filter or sort records, or merge multiple data sources into one, do that at the data source level before you bind a data-aware control to this source.

Binding the VGridControl

To bind a VGridControl control to a data source, use the VGridControl.DataSource and VGridControl.DataMember properties. It is possible to bind a control to a DataTable, DataView, IBindingList or IList objects. See the following topics for more information.

In bound mode, you can implement unbound rows - rows that are not bound to any data source field. These rows need to be populated with data manually. See Unbound Rows to learn more.

Binding the PropertyGridControl

To bind a PropertyGridControl to an object or an array of objects, use the PropertyGridControl.SelectedObject or PropertyGridControl.SelectedObjects property. After the object has been assigned to the control, its properties are retrieved as rows, according to the PropertyGridControl.AutoGenerateRows option.

Unbound Mode

The VGridControl control supports the unbound mode. In this mode a control is not bound to any data source (its VGridControl.DataSource and VGridControl.DataMember properties are not specified). Rows need to be added manually. In this mode, end-users can still edit rows. So, to improve the effectiveness of the application, you can assign editors to rows and initial edit values, if required. This method of using the vertical grid is similar to using a set of editors arranged in a specific manner (data cells), with labels corresponding to them (row header cells). See the following link for more information.

NOTE

The PropertyGridControl doesn't support the unbound mode. You must bind the control to an object or an array of objects via the PropertyGridControl.SelectedObject or PropertyGridControl.SelectedObjects property.