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.
- Traditional Data Binding Methods
- Data Binding Mechanism in ADO.NET
- Binding Controls to Data Created at Runtime
How to: Bind GridControl to Database and Implement Master-Detail Mode at Design Time
- How to: Bind a Control to a Database at Runtime
- How to: Bind a Control to Data Created at Runtime
- How to: Bind a Control to Data in an XML File
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.