A newer version of this page is available. Switch to the current version.

Binding to Data

  • 2 minutes to read

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

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.