Question : Refresh after editing LinqDataSource via Gridview causes: "Row not found or changed" error

I have a very simple page (for testing purposes) with a LinqDataSource connecting to a single table, and then associated with a GridView. After editing & then updating a row in the GridView, if I perform a Refresh, the following error is displayed:

System.Data.Linq.ChangeConflictException: Row not found or changed

What causes this, and more importantly of course, how do I resolve it?

Here's the code that throws the error:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
  <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
	ContextTypeName="UserDataContext" EnableUpdate="True" EntityTypeName="" 
	TableName="IndustryMains">
  </asp:LinqDataSource>
  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
	DataKeyNames="ID" DataSourceID="LinqDataSource1">
	<Columns>
	  <asp:CommandField ShowEditButton="True" />
	  <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
		ReadOnly="True" SortExpression="ID" />
	  <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
	</Columns>
  </asp:GridView>

Answer : Refresh after editing LinqDataSource via Gridview causes: "Row not found or changed" error

Random Solutions  
 
programming4us programming4us