protected void grdRiders_RowDeleting(object sender, GridViewDeleteEventArgs e) { DataSet dsPolicyRider = (DataSet)Session["dsPolicyRider"]; dsPolicyRider.Tables[0].Rows[e.RowIndex].Delete(); //(dsPolicyRider, e.RowIndex); this.BindControl(this.grdRiders); this.CalculatePremium(true); }This apparently works as the row is removed from the GridView, but then when I try to save this change I get this error:
Deleted row information cannot be accessed through the row. 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.Data.DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row. Source Error: Line 67: { Line 68: if (this.Row != null) Line 69: return (Guid)mmType.GetNonNullableDbValue(this.Row["PolicyRiderPK"], "System.Guid"); Line 70: else Line 71: return this._policyRiderPK; Source File: C:\Development\Mere Mortals .NET Framework 2008\SamaanSystems\IAS.Business\PolicyRider\PolicyRiderEntity.cs Line: 69 Stack Trace: [DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row.] System.Data.DataRow.GetDefaultRecord() +4814901 System.Data.DataRow.get_Item(String columnName) +22 SamaanSystems.IAS.Business.PolicyRiderEntity.get_PolicyRiderPK() in C:\Development\Mere Mortals .NET Framework 2008\SamaanSystems\IAS.Business\PolicyRider\PolicyRiderEntity.cs:69 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0 System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +350 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29 System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +53 System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) +20 OakLeaf.MM.Main.Collections.mmPropertyComparer`1.GetPropertyValue(Object objRef, String propertyName) +87 OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.GetPrimaryKeyValue(EntityType entity) +174 OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.CallStateChange(mmBusinessState bizState, EntityType entity) +50 OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.PreSaveEntityListProcessing(mmBindingList`1 entityList) +446 OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.PreSaveProcessing() +64 OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.CheckRules(mmBusinessObjectGeneric`1 businessObject, mmBindingList`1 entityList) +802 OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.CheckRules() +71 OakLeaf.MM.Main.Business.mmBusinessObjectGeneric`1.CheckRules(mmBusinessObject businessObject, DataSet ds, String tableName) +97 OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey, IDbDataAdapter dbAdapter) +410 OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName, String databaseKey) +53 OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds, String tableName) +83 OakLeaf.MM.Main.Business.mmBusinessObject.SaveDataSet(DataSet ds) +74 OakLeaf.MM.Main.Web.UI.mmBusinessWebPage.Save(mmBusinessObject bizObj, DataSet ds, String tableName) +187 SamaanSystems.IAS.Web.PolicyEdit.btnSave_Click(Object sender, EventArgs e) in C:\Development\Mere Mortals .NET Framework 2008\SamaanSystems\IAS.Web\PolicyEdit.aspx.cs:892 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3614If I comment out the CalculatePremium call, then I don't get the error.