ASP.NET GridView Error: "Update is disabled for this control"

I have an absolutely simple setup that you can imagine. A single table defined in the Entity model in ASP.net v4, the model is bound directly to the GridView with AutoGenerateEditButton enabled.

However, every time I click "Edit" and then save, the page gives an error message "Update is disabled for this control", for which I can not find a solution.

What causes this error? What can be done to solve it?

<%
<asp:GridView ID="MenuItemsGrid" runat="server"
    DataSourceID="gridDataSource"
    AutoGenerateEditButton="true"
    AutoGenerateColumns="true">  
</asp:GridView>  

<asp:EntityDataSource ID="gridDataSource" runat="server"
    ConnectionString="name=dataEntitiesModel"
    DefaultContainerName="dataEntities"
    EntitySetName="MenuItems" />
%>
+5
source share
1 answer

, . / .

<%
<asp:EntityDataSource ID="gridDataSource" runat="server" 
    ConnectionString="name=dataEntitiesModel"
    DefaultContainerName="ASDKidsPlayEntities" EntitySetName="MenuItems" 
    EnableDelete="True" EnableInsert="True" EnableUpdate="True"/>
%>
+12

All Articles