The GridTableView object has an Items property that contains all the data rows in the table view. Each row is represented by a GridDataItem or GridEditFormItem object, depending on whether the row is an edit form. The GridDataItem or GridEditFormItem has an ItemIndex property that is its index in the Items property collection.

When implementing an event handler for an event such as ItemCreated, ItemDataBound, ItemCommand, UpdateCommand, InsertCommand or DeleteCommand, you can obtain a GridDataItem or GridEditFormItem for the row from the event arguments (e.Item or, in a hierarchical grid, e.Item.OwnerTableView.ParentItem).

'e is the event argument object
If TypeOf e.Item Is GridDataItem Then
Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
ElseIf TypeOf e.Item Is GridEditFormItem Then
Dim editItem As GridEditFormItem = CType(e.Item, GridEditFormItem)
End If

Because of features such as column reordering and grouping, the index of individual columns can change on the client. This means that using indexes to access individual cells in the Cells collection of a row is not a reliable method of obtaining a cell in a particular column.

To provide a reliable way of locating the cell in a particular column, each column in the grid has a UniqueName propertyof type string. This property is assigned automatically at design time. For example, an auto-generated GridBoundColumn with DataField 'ContactName' generates a UniqueName of 'ContactName').You can also set the UniqueName property explicitly, although the automatic generation handles most cases. Using the UniqueName property of a column lets you reliably locate a column even when its index changes.

This approach of obtaining cell values works for auto-generated columns and built-in column types except for GridTemplateColumn and GridCheckBoxColumn . For template columns, you must find the control in the grid cell and extract its value.

When you need to retrieve value from a GridCheckBoxColumn you have to first get reference to the TableCell object and cast the first control from its Controls collection to a CheckBox. Then you can use the Checked property for retrieving the checked state:

The same approach can be applied to header and footer items. Simply reference the header or footer item of the control and use the column UniqueName property to identify the cell of interest:

GridHeaderItem headerItem = RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;
// fetch the data with headerItem["ColumnUniqueName"].Text
// or (headerItem["ColumnUniqueName"].Controls(0) as LinkButton).Text if sorting is enabled

Accessing the cell value via the cell.Text approach demonstrated in the previous section works for the majority of the scenarios. However, in some cases, the Text of the cell is modified, e.g. when using the DataFormatString property of the column, therefore, the obtained value would not be the same as in the database. For instance, it is a common practice to display numeric values as Currency and it may turn out a troublesome task to parse the string text back to its original numeric form.

In such cases, it is useful to extract the data directly from the underlying DataItem object of the GridDataItem instance. The DataItem is available only within the OnItemDataBound event handler provided by RadGrid.

Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
If TypeOf e.Item Is GridDataItem Then
Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
Dim value = DataBinder.Eval(item.DataItem, "ShipCountry")
End If
End Sub

If you need to get the value during any other phase, you can include the Field name in the DataKeyNames property of the MasterTableView or the corresponding GridTableView tag and use the GetDataKeyValue method.

While accessing cells with Template columns remains the same, you could use a little different approach to get the controls in the cell. For example, to access a TextBox declared in the ItemTemplate of the column:

If the grid item is in edit mode, you can still use the column's UniqueName to access the cell (even if it is in an edit form). Then you can locate the control that contains the cell's value and, depending on the type of the column editor, cast it to the appropriate type, and access the value.

InPlace EditMode is supported only for an AutoGenerated EditFormType. In this case, the editable item is of type GridDataItem or GridDataInsertItem , rather than GridEditFormItem and GridEditFormInsertItem as usual.

Essentially, Batch editing is a bit different from the other Edit modes. It is mainly a client-side functionality and in this sense, it would be reasonable to implement javascript approaches when accessing the individual elements generated in the cells. This can be achieved using the client-side event handlers provided by RadGrid regarding its Batch editing feature:OnBatchEditOpened Client-Side Event

Let's take for example the GridDateTime column of a RadGrid with 10 items per page. Unlike the other Edit modes, there are not 10 different RadDatePicker controls generated to edit each of the records, but there is only 1 picker loaded on the server, which contributes for ideal performance and rendering optimization. If you access the generated picker on code-behind and apply some properties, e.g. FocusedDate, the setting will be applied to all the picker elements of the column.

The next approach enables extracting the raw value directly in its original database form. The required action is to add the Field name in the ClientDataKeyNames property of the MasterTableView or the corresponding GridTableView tag.

In a hierarchical grid, each item in the Items collection of a parent GridTableView has a ChildItem property of type GridNestedViewItem. This child item is the container for the nested child table(s). The GridNestedViewItem has a NestedTableViews property that holds the collection of all the detail tables for the parent table.

You can use these properties to access the detail tables of a row in the parent table, as follows: