GridViewRow item = this.Rows[this.EditIndex]; int CellNumber = 0; foreach (TableCell cell in item.Cells) { // Need to check HasControls because if a column is set to ReadOnly, // HasControls() returns false. Trying to process the controls collection // when HasControls() is false, throws an exception. if (cell.HasControls()) { DataControlField column = this.Columns[CellNumber]; BoundField BoundCol = column as BoundField; if (BoundCol != null) { TextBox TxtBox = cell.Controls[0] as TextBox; if (TxtBox != null) { mmReflection.SetPropertyValue(entityList[this.EditIndex], BoundCol.DataField, TxtBox.Text); } else { CheckBox ChkBox = cell.Controls[0] as CheckBox; if (ChkBox != null) { mmReflection.SetPropertyValue(entityList[this.EditIndex], BoundCol.DataField, ChkBox.Checked); } } } } CellNumber++; }