RadControls version
|
2012 Q1 and later
|
.NET version |
.NET 2.0 and later |
Visual Studio version |
2008 and later
|
programming language |
C#/VB.NET
|
browser support |
all browsers supported by RadControls
|
PROJECT DESCRIPTION
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 Telerik RadGrid items). | That is why each column in Telerik RadGrid 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).
DEMO INSTRUCTIONS
To test the functionality on this example:
- Check a row to highlight its ship name
- Edit a row and change the order id selection to load relevant quantities in stock