I followed the getting started guide, and did the simple grid against a sqlserv2000 northwind db.
(see attached "1.gfi")
When I hit the Edit, then Update links, I get this error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
The entity object cannot be null. If using a data bound control, the DataKeyNames property must be configured (i.e. GridView.DataKeyNames or FormView.DataKeyNames).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: The entity object cannot be null. If using a data bound control, the DataKeyNames property must be configured (i.e. GridView.DataKeyNames or FormView.DataKeyNames).
Source Error:
Line 1946: if ( keys != null && keys.Count < 1 )
Line 1947: {
Line 1948: throw new ArgumentException("The entity object cannot be null. If using a data bound control, the DataKeyNames property must be configured (i.e. GridView.DataKeyNames or FormView.DataKeyNames).");
Line 1949: }
Line 1950:
Source File: C:\NetTiers\Northwind\Northwind.Web\Data\BaseDataSource.cs Line: 1948
Stack Trace:
[ArgumentException: The entity object cannot be null. If using a data bound control, the DataKeyNames property must be configured (i.e. GridView.DataKeyNames or FormView.DataKeyNames).]
Northwind.Web.Data.BaseDataSourceView`2.ValidateEntity(Entity entity, IDictionary keys) in C:\NetTiers\Northwind\Northwind.Web\Data\BaseDataSource.cs:1948
Northwind.Web.Data.BaseDataSourceView`2.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) in C:\NetTiers\Northwind\Northwind.Web\Data\BaseDataSource.cs:1564
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +179
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1140
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +835
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +162
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +118
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +107
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +175
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +244
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3837
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
CODE:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Northwind.Website._Default" %>
@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Northwind.Website._Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">
html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">
head runat="server"><title>Home Page</title></head><body>
<title>Home Page</title></head><body>
head><body>
body><form id="form1" runat="server" >
<form id="form1" runat="server" ><atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" /><div>
<div><asp:GridView ID="GridView1" runat="server"
<asp:GridView ID="GridView1" runat="server"
ID="GridView1" runat="server"
runat="server"DataSourceID="EmployeeDS" Font-Names="Verdana" Font-Size="Smaller" AutoGenerateColumns="False">
DataSourceID="EmployeeDS" Font-Names="Verdana" Font-Size="Smaller" AutoGenerateColumns="False">
Font-Names="Verdana" Font-Size="Smaller" AutoGenerateColumns="False">
Font-Size="Smaller" AutoGenerateColumns="False">
AutoGenerateColumns="False"><Columns>
<Columns><asp:CommandField ShowSelectButton="True" />
<asp:CommandField ShowSelectButton="True" /><asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowEditButton="True" /><asp:CommandField ShowDeleteButton="True" />
<asp:CommandField ShowDeleteButton="True" /><asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" InsertVisible="False"
<asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" InsertVisible="False"ReadOnly="True" SortExpression="EmployeeID" />
ReadOnly="True" SortExpression="EmployeeID" /><asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /><asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" /><asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" /><asp:BoundField DataField="EntityState" HeaderText="EntityState" SortExpression="EntityState" />
<asp:BoundField DataField="EntityState" HeaderText="EntityState" SortExpression="EntityState" /><asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" /><asp:BoundField DataField="Region" HeaderText="Region" SortExpression="Region" />
<asp:BoundField DataField="Region" HeaderText="Region" SortExpression="Region" /><asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" />
<asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" /></Columns>
</Columns></asp:GridView>
</asp:GridView>
<data:EmployeesDataSource id="EmployeeDS"
<data:EmployeesDataSource id="EmployeeDS"
id="EmployeeDS"SelectMethod="GetAll"
SelectMethod="GetAll"EnablePaging="true" EnableSorting="true"
EnablePaging="true" EnableSorting="true"
EnableSorting="true"runat="server" >
runat="server" ></data:EmployeesDataSource>
</data:EmployeesDataSource></div>
</div></form>
</form><script type="text/xml-script">
<script type="text/xml-script"><page xmlns:script="http://schemas.microsoft.com/xml-script/2005"><references>
</references>
<components>
</components>
</page>
</script></body></html>
"http://schemas.microsoft.com/xml-script/2005"><references>
</references>
<components>
</components>
</page>
</script></body></html>
</script></body></html>
body></html>
html>