The 'Row not found or changed' error occurs
- 2 minutes to read
Error Description
When ASPxGridView is bound to LinqDataSource
or LinqServerModeDataSource
, the following exception can occur: “Row not found or changed”.
Solution for LinqDataSource
Do the following to resolve this issue:
- Set the
ColumnAttribute.UpdateCheck
property toNever
orWhenChanged
. - Set the
LinqDataSource.StoreOriginalValueInViewState
property tofalse
.
Solution for LinqServerModeDataSource
The issue may occur when the data source contains a field of the timestamp type. ASPxGridView cannot determine the appropriate editor for such data and does not generate a column for this field in the Columns collection. The field values are not included in the OldValues
and NewValues
dictionaries used in GRUID operations.
To resolve this issue, use either of the following approaches:
Solution 1: Add a column to a grid.
- Add a column in the ASPxGridView and bind it to the timestamp field.
- Set the Column.Visible property to
false
to hide the column. - Populate the old value of the column during CRUID operations to allow the LINQ provider to compare previous and new values (the new values are generated by the database server).
<dx:ASPxGridView ID="Grid" ... OnRowUpdating="Grid_RowUpdating" />
protected void Grid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) {
e.OldValues["Version"] = (sender as ASPxGridView).GetRowValuesByKeyValue(e.Keys[0], "Version");
}
Solution 2: Remove timestamp field from a DataContext.
Open the **.dbml* DataContext file and delete the timestamp field.