Skip to main content

Cells

  • 2 minutes to read

Important

This documentation topic describes legacy technology. We no longer develop new functionality for the GridControl and suggest that you use the new DataGridView control instead.

GridControl displays data using columns and rows. These elements correspond to bound data source fields and records respectively. Each row displays data cells arranged in a column layout. In other words, data cells are located at the intersection of rows and columns. Each data cell corresponds to a field value within a record in a data source. Cells are used to display and edit data.

The grid provides a set of methods allowing you to obtain and modify its cell values, regardless of whether end-users are allowed to edit data. The required cell is identified by specifying its owning row and column. The row is specified by its handle. The column can be specified by its name or field name. For detailed information on how to obtain row handles and identify columns, see Identify and Access Rows and Identify and Access Columns.

Get Cell Values

GridControl provides the following methods for obtaining cell values.

Method Description
GridControl.GetCellValue Returns the value of the specified data cell in the grid.
GridControl.GetGroupRowValue, IGroupInfo.Value Returns the value for which the group is created (a value which is displayed in a group row).
GridControl.GetCellDisplayText Returns the text displayed within the specified cell.

It is also possible to get cell values using the functionality provided by the grid’s data source. To do this, call the GridControl.GetRow method. It returns an IRowData object providing access to a grid’s row data. Then you can use this object’s IRowData.GetFieldValue method to get values of the specified fields within the processed row, or use the IRowData.DataObject property to access an object representing a data source’s record and then call its methods to retrieve field values.

Set Cell Values

To set a value of the specified cell, use the GridControl.SetCellValue method.

To invoke an in-place editor programmatically, call the GridControl.OpenEditor method. When an end-user closes an in-place editor to apply or cancel changed cell values, the GridControl.EndRowEdit event is raised.