Hi Eric,
A couple of things here. When a new Parent is added, how is the primary key being created? Is this done at the database or are you adding it in the HookSetDefaults method of the parent business object?
When you add a new parent record and then need to add the child record you should be able to just get the parents PK via the entity object rather than all this code you have below.
Plus you mention the AutoSaveOnParentSaved property being disabled but it is the ForeignParentKeyField property setting that causes the child objects foreign key to get populated with the parents PK. If you are not setting the parent tables PK in the HookSetDefaults method, I would consider setting it here so it is available for the business object to be able to populate the child record.
Hope some of that helps out.
Tim
>I got it to work, but it's kludgy and I'm sure not the proper way.
>
>The base of the problem seems to be that the ParentKeyValue property wasn't getting properly set in the child object before its Save. So I disabled the autoSaveOnParentSaved setting, and changed my save to this:
>
> if (lReturn)
> {
> // Kludge! For new links
> if (this.oMemberLink.Entity.numIndID == null || this.oMemberLink.Entity.numIndID == 0)
> {
> String cIdField = (lNewContact ? "newId" : "numIndId");
> int iNewMemberId = Convert.ToInt32(this.oContact.DataSet.Tables[0].Rows[0][cIdField]);
> this.oMemberLink.Entity.numIndID = iNewMemberId;
>
> this.oMemberLink.SaveEntity();
> }
> Response.Redirect("findName.aspx?txtFind=" + this.txtLastName.Text);
> }
>
>
>And hurray, it works. Now, onto the next big problem (trying to get mmCheckBoxLists to populate properly...
Timothy Bryan