Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have the absolutely most simple setup imaginable. A single table defined in an Entity model in ASP.net v4, the model is bound directly to a GridView with AutoGenerateEditButton enabled.

However, each time I hit edit, then save, the page throws the error “Update is disabled for this control" for which I cannot find a solution.

What is causing this error? What can do to resolve 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" />
%>
like image 691
NTDLS Avatar asked Jan 10 '11 23:01

NTDLS


1 Answers

Well, that was easy. The data source needs to be enabled for insert/edit & delete.

<%
<asp:EntityDataSource ID="gridDataSource" runat="server" 
    ConnectionString="name=dataEntitiesModel"
    DefaultContainerName="ASDKidsPlayEntities" EntitySetName="MenuItems" 
    EnableDelete="True" EnableInsert="True" EnableUpdate="True"/>
%>
like image 161
NTDLS Avatar answered Oct 05 '22 22:10

NTDLS