Skip to main content

Obtaining and Setting Cell Values

  • 2 minutes to read

The grid provides multiple methods that allow 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 Obtaining Row Handles and Accessing and Identifying Columns.

#Obtaining Cell Values

Use the following methods to obtain cell values:

Method

Description

GridControl.GetCellValue

Returns the value of a specified cell.

GridControl.GetFocusedRowCellValue

Returns the value of a specified cell displayed within a focused row.

The focused row isn't displayed if the DataViewBase.NavigationStyle property is set to GridViewNavigationStyle.None.

GridControl.GetFocusedValue

Returns the focused cell's value.

The focused cell is displayed if the DataViewBase.NavigationStyle property is set to GridViewNavigationStyle.Cell. Otherwise, this method returns null.

TreeListView.GetNodeValue

Returns the value of the specified cell displayed within the specified node.

GridControl.GetFocusedRowCellDisplayText

Returns the focused cell's text.

GridControl.GetCellDisplayText

Returns the text displayed within a specified cell.

#Setting Cell Values

Method

Description

GridControl.SetCellValue

Sets the value of the specified cell.

TreeListView.SetNodeValue

Sets the value of the specified cell in the specified node.

GridControl.SetFocusedRowCellValue

Sets the value of the specified cell displayed within the focused row.

The focused row isn't displayed if the DataViewBase.NavigationStyle property is set to GridViewNavigationStyle.None.

Once the cell's value has been changed, the GridViewBase.CellValueChanged event is raised.