Guid newPK = (Guid)dsBeneficiary.Tables[0].Rows[dsBeneficiary.Tables[0].Rows.Count - 1]["BeneficiaryPK"];just prior to this line I do a:
this.oBeneficiary.NewRow(dsBeneficiary, this.oBeneficiary.TableName);My Beneficiary .cs sets a default BeneficiaryPK using:
entity.BeneficiaryPK = Guid.NewGuid();The Watch window shows {} as the value for dsBeneficiary.Tables[0].Rows[dsBeneficiary.Tables[0].Rows.Count - 1]["BeneficiaryPK"].
System.InvalidCastException was unhandled by user code Message="Specified cast is not valid." Source="SamaanSystems.IAS.Web" StackTrace: at SamaanSystems.IAS.Web.PolicyEdit.btnAddBeneficiary_Click(Object sender, EventArgs e) in C:\Development\Mere Mortals .NET Framework 2008\SamaanSystems\IAS.Web\PolicyEdit.aspx.cs:line 592 at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) InnerException:Any ideas what I have done wrong?