dotnetmonitor.com

 
Index
Previous
Next

 

The data you display in the DataGridView control will normally come from a data source of some kind, but you might want to display a column of data that does not come from the data source. This kind of column is called an unbound column.

 

You can add unbound columns to a DataGridView control in bound mode. This is useful when you want to display a column of buttons or links that enable users to perform actions on specific rows. It is also useful to display columns with values calculated from bound columns. You can populate the cell values for calculated columns in a handler for the CellFormatting event. If you are using a DataSet or DataTable as the data source, however, you might want to use the DataColumn.Expression property to create a calculated column instead. In this case, the DataGridView control will treat calculated column just like any other column in the data source.

 

Sorting by unbound columns in bound mode is not supported. If you create an unbound column in bound mode that contains user-editable values, you must implement virtual mode to maintain these values when the control is sorted by a bound column.

 

Virtual mode should also be used in mix mode when the additional data being displayed cannot be calculated based upon the data that the grid is bound to or when the data is updated frequently. For more info about Virtual mode, see the Virtual Mode topic later in this document.

What is the DataGridView
Differences between the DataGridView and DataGrid controls
Highlight of features
Structure of DGV
Architecture Elements
Cells and Bands