Sql – GridView will not update underlying data source


So I'm been pounding on this problem all day. I've got a LinqDataSource that points to my model and a GridView that consumes it. When I attempt to do an update on the GridView, it does not update the underlying data source. I thought it might have to do with the LinqDataSource, so I added a SqlDataSource and the same thing happens. The aspx is as follows (the code-behind page is empty):

  <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
      ConnectionString="Data Source=devsql32;Initial Catalog=Steam;Persist Security Info=True;" 
      SelectCommand="SELECT [LangID], [Code], [Name] FROM [Languages]" UpdateCommand="UPDATE [Languages] SET [Code]=@Code WHERE [LangID]=@LangId">
  <asp:GridView ID="_languageGridView" runat="server" AllowPaging="True" 
      AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="LangId" 
          <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
          <asp:BoundField DataField="LangId" HeaderText="Id" ReadOnly="True" />
          <asp:BoundField DataField="Code" HeaderText="Code" />
          <asp:BoundField DataField="Name" HeaderText="Name" />
  <asp:LinqDataSource ID="_languageDataSource" ContextTypeName="GeneseeSurvey.SteamDatabaseDataContext" runat="server" TableName="Languages" EnableInsert="True" EnableUpdate="true" EnableDelete="true">

What in the world am I missing here? This problem is driving me insane.

Best Solution

You are missing the <UpdateParameters> sections of your DataSources.



Related Question