Hi Weston,
In order to build a relation between two
RadGrid controls based on selected cell in the parent grid you might opt for firstly setting the cell selection mode to single cell from the Client Settings and to set the
EnablePostBackOnRowClick property to true as following:
Secondly, the event
OnSelectedCellChanged has to be added to the
RadGrid control. In the code-behind the
RadGrid control has a
SelectedCells collection which holds the selected cells of type
GridTableCell. This will allow you to obtain the value from the currently selected cell. Thus, depending on your specific scenario you have two options - you may access the cell value directly and the second one is to use the
GetDataKeyValue method to extract the unique datakey ID of the corresponding row. These values can later be used to build the relation to the second
RadGrid. Note that in order to use the second option, the property
DataKeyNames in the
MasterTableView tag has to be set accordingly:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-raw-field-data-and-key-values
Here is an actual sample:
Once you have the information from the selected cell you can use a parameter to achieve the scenario demonstrated in the
Master/Detail Grids demo - establishing the relation between the two grids.
Alternatively, you might choose to follow the example set in the sample project attached to my response which uses programmatic binding.
Regards,
Tsvetomir
Progress Telerik