Due to features like column reorder, grouping, etc. it is not appropriate to pass indexes to
the Cells collection of a grid row (in order to reference cells in r.a.d.
grid items). |
That is why each column in r.a.d.
grid has a
UniqueName property of type string.
This property is assigned automatically by the designer (for example, a GridBoundColumn with
DataField 'ContactName' would generate a UniqueName of 'ContactName'). You can also set it
explicitly as well if you need.
Thus, if you previously reordered the columns in the grid, you will still be able to obtain
the value from the respective column although it actually has a
new location in the grid structure.
The main idea when retrieving values from grid items is to obtain reference to
e.Item and
e.Item.OwnerTableView.ParentItem (in hierarchical grid) in the
ItemCreated/ItemDataBound/ItemComand/UpdateCommand/InsertCommand/DeleteCommand/etc.
handlers. Then you can get the cell values using column unique names as depicted previously.
About the second part of the demo:
Sometimes you may want to get reference to controls in grid row/edit form and modify their
state depending on the option the user chooses for another control in the same row/edit form.
Basically, you can reference the grid item which wraps the controls (either data item or edit
form item), then locate the other control and modify its state as per your custom needs.
In some cases (when there are additional containers in the rows), you may need to find the
container first and then propagate the same steps (described above in this paragraph).
Further information about this subject or how to persist checkbox state in the
template column of this demo you can find in these topics from the product
online documentation:
Accessing cells and rows
Referencing controls in grid row/edit form
Persist checkbox state in template column on rebind