ComponentOne True DBGrid for WinForms
Data Binding / Using Unbound Columns
In This Topic
    Using Unbound Columns
    In This Topic

    Normally, True DBGrid for WinForms automatically displays data from bound database fields. However, you may need to augment the set of fields present in your layouts with columns derived from database fields, or columns that are unrelated (or only loosely related) to database information. For example, if your database contains a Balance field, you may instead want to display two columns, Credit and Debit, to show positive and negative numbers separately. Or, you may want to look up data in another database, or convert field data to some other form, such as mapping numeric codes to textual descriptions.

    To accomplish such tasks you can use unbound columns. The term unbound column refers to a column that is part of a bound grid, but is not tied directly to a database field.

    Columns that do not have the DataField property set (that is, the DataField property is equal to an empty string), but do have the column Caption property set are considered unbound columns. The grid will request data for these columns through the UnboundColumnFetch event.

    Columns with their DataField property set will be bound, if the DataField property is the same as one of the fields of the Data Source.

    Columns with their DataField property set to a value that is not in the DataSet are ignored for the purposes of fetching data. Similarly, columns that have no value for both the DataField and Caption properties set are also ignored.

    See Also