Skip to main content

Obtain and Set Cell Values in Code

  • 2 minutes to read

You can use the GridControl‘s methods to obtain and modify cell values.

Refer to Obtaining Row Handles and Accessing and Identifying Columns for information on how to obtain row handles and identify columns.

Obtain Cell Values

Method

Description

GridControl.GetCellValue

Returns the value of the specified cell.

GridControl.GetFocusedRowCellValue

Returns 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.

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 the specified cell.

Set 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.

Note

You can use methods above even if end users are not allowed to edit data.

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

See Also