This is a migrated thread and some comments may be shown as answers.

Error In RadGrid in Dynamic Data

1 Answer 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stephen Naughton
Top achievements
Rank 1
Stephen Naughton asked on 02 Oct 2010, 04:49 PM
I get the following error (Using VS2010 .Net and Dynamic Data + latest DD bits for Telerik RadGrid, and Entity Framework for data model);

Error: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.

when Inserting with the following code;
<Columns>
    <telerik:GridTemplateColumn UniqueName="CommandColumn">
        <ItemTemplate>
            <asp:LinkButton runat="server" ID="LinkButton1" Text="Edit" CommandName="Edit" /><br />
            <asp:LinkButton runat="server" ID="LinkButton2" Text="Delete" CommandName="Delete" OnClientClick='return confirm("Are you sure you want to delete this item?");'/>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:LinkButton runat="server" ID="LinkButton1" Text="Update" CommandName="Update" /><br />
            <asp:LinkButton runat="server" ID="LinkButton2" Text="Cancel" CommandName="Cancel" CausesValidation="false" />
        </EditItemTemplate>
    </telerik:GridTemplateColumn>
    <%--<telerik:GridEditCommandColumn />
    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" ConfirmText="Are you sure you want to delete this item?" />--%>
</Columns>

Note I've commented out the telerik command columns (wich work fine) to get the command buttons in the same column (and use icons removed for simplification)

Note: the error only occurs when clicking Update during Insert, and just by changing button the the two telerik buttons commented out the error goes away :(

Regards
Steve Naughton (MVP)

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 07 Oct 2010, 09:21 AM
Hi Stephen,

Thank you for contacting us.

I tried to reproduce the described issue but to no avail. I am sending you a simple example which contains the RadGrid with the TempalteColumn from the code snippet which you posted. Please check it out and let me know what differs in your case.
Additionally if the described error is caused by ConcurrencyException you could check out the following online resources which explain the possible solutions:
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/9fe80b08-0b67-4163-9cb0-41dee5115148
http://blogs.msdn.com/b/cesardelatorre/archive/2008/09/05/optimistic-concurrency-updates-using-entity-framework-in-n-tier-and-n-layer-applications-part-2.aspx
http://naspinski.net/post/Store-update2c-insert2c-or-delete-statement-affected-an-unexpected-number-of-rows-%280%29-Entities-may-have-been-modified-or-deleted-since-entities-were-loaded-Refresh-ObjectStateManager-entries.aspx
http://stackoverflow.com/questions/1836173/entity-framework-store-update-insert-or-delete-statement-affected-an-unexpect

Looking forward for your reply.

Regards,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Stephen Naughton
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or