Is there another way to implement this?
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode && e.Item.OwnerTableView.Name == "DeviceDetail")
{
//the dropdown list will be the first control in the Controls collection of the corresponding cell
DropDownList list = (e.Item as GridEditableItem)["DeviceTypeDropDown"].Controls[0] as DropDownList;
list.AutoPostBack =
true;
list.SelectedIndexChanged +=
new EventHandler(DeviceTypeIndex_Changed);
}
void
DeviceTypeIndex_Changed(Object sender, EventArgs e)
{
DropDownList list = sender as DropDownList;
GridEditableItem editedItem = (sender as DropDownList).NamingContainer as GridEditableItem;
if (((DropDownList)sender).SelectedItem.Text == "Device1")
{
editedItem[
"isDeviceAdjacent"].Controls[0].Visible = true;
}
else
{
editedItem[
"isDeviceAdjacent"].Controls[0].Visible = false;
}
}