I'm having a little difficulty with updating a hierarchical grid. My gird has 3 levels, orders,deliveries and schedules. On my top level, I want to be able to directly update the grid row on a few of the columns. I have a sample program where I do the same thing on a normal grid and it works. Identical code in my Hierarchical grid does not. The problem I'm having is when it come time for me to assign the grid item it's new value. For some reason, my grid item is being determined as read-only upon assignment and is failing. I've confirmed that the item is not read-only, but when I try to update it, it's being rendered as read-only and I don't know why. My update routine is as follows. Any help with this would be appreciated. Thanks.
protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
{
if (column is IGridEditableColumn)
{
IGridEditableColumn editableCol = (column as IGridEditableColumn);
if (editableCol.IsEditable)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
object oldval = editedItem.SavedOldValues[column.UniqueName];
GridEditManager editMan = editedItem.EditManager;
IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
object editorValue = null;
editorValue = (editor as GridTextColumnEditor).Text;
try
{
DataRow[] changedRows = this.ItemSource.Select("ORDER = '" + editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex] ["ORDER"].ToString() + "'");
changedRows[0][column.UniqueName] = editorValue; // This is the line where the error is occurring !!!
ItemSource.AcceptChanges();
}
catch (Exception ex)
{
Label1.Text = "<strong>Unable to set value of column '" + column.UniqueName + "'</strong> - " + ex.Message;
e.Canceled = true;
break;
}
}
}
}
}