When I attempt to save a record from the entitygridview, I get this error:
[NullReferenceException: The entity object cannot be null.] IGD.Web.Data.BaseDataSourceView`2.ValidateEntity(Entity entity, IDictionary keys) in C:\Projects\xxx\IGD.Web\Data\BaseDataSource.cs:1940 IGD.Web.Data.BaseDataSourceView`2.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) in C:\Projects\xxx\IGD.Web\Data\BaseDataSource.cs:1558 System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78 System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1215 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +837 System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +117 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +132 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
|
Here is my code:
<data:EntityGridView DataKeyNames="ManufacturerID" ID="gridManufacturer" runat="server" DataSourceID="dataManufacturer" AllowExportToExcel="True" AllowMultiColumnSorting="False" AllowPaging="True" AutoGenerateColumns="False" DefaultSortColumnName="ManufacturerId" DefaultSortDirection="Ascending" ExportToExcelText="Excel" PageSelectorPageSizeInterval="10">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="ManufacturerId" HeaderText="ManufacturerId" ReadOnly SortExpression="ManufacturerId" />
<asp:BoundField DataField="ManufacturerName" HeaderText="ManufacturerName" SortExpression="ManufacturerName" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
</Columns>
</data:EntityGridView>
<data:ManufacturerDataSource ID="dataManufacturer" SelectMethod="GetPaged" runat="server" EnablePaging="True">
<DeepLoadProperties Method="IncludeChildren" Recursive="False">
</DeepLoadProperties>
</data:ManufacturerDataSource>
Am I missing something? The Auto-generated admin screen doesn't work right, either. No matter what record you edit, it always updates where ManufacturerID = 1.