General information
Category:
The Mere Mortals .NET Framework
Environment versions
Network:
Windows 2003 Server
>>>Larry,
>>>
>>>>Hi Kevin/All,
>>>>assuming (yeah I know...) I've set correctly as per the docs in my child object.partial ForeignParentKeyField="myparentid" and AutoSaveOnParentSaved=true, and in my form I've done parent.RegisterChildBizObj(Parent, "Parent").
>>>>
>>>>When adding a new row (mmButtonNew) to a child object, can you tell me when/in what event the child.parentid will get set automatically?
>>>>
>>>>Currently seems to fail after a save attempt (field required) but gets filled after I acknowledge the error dialog, so I can then save.
>>>>
>>>>I can take care of it by setting the field myself in a postnewrow event, but I'd like to handle the mm way if possible.
>>>>
>>>>thanks,
>>>>
>>>>-Larry
>>>
>>>in the business object there is a method called PopulateForeignParentKeyField(). This is called from:
>>>SaveEntity()
>>>SaveEntityList()
>>>and
>>>SaveDataSet()
>>>
>>>When you use the mmButtonSave in a form you will probably hit the latter of those methods after several of the overloads. I would guess that either the ParentKeyID is not getting set or some other thing is failing along the way. I would probably put a breakpoint in the SaveDataSet(string tableName, int currentRow) method early and step through the overloads until you see what is happening when you get to the call to PopulateForeignParentKeyField method. You will likely break here more than once, so you could just continue when it is saving your parent record.
>>>
>>>Tim
>>
>>
>>Hi Tim,
>>thanks, so it's definately after save is initiated (in my case .SaveEntityList), which is why I wasn't seeing it after adding a new row (not saved yet). Guess I read that somewhere, and it makes sense.
>>
>>-Larry
>
>There is an overload for NewRow that allows you to pass in a Default Values object if that would be helpful. What was the error dialog you were getting if it was occuring before the save?
>Tim
Hi Tim,
wasn't an error message (before trying to save) was me stepping through the code and seeing the value hadn't been set yet, so was wondering why it wasn't. Your answer that it doesn't get set until I save makes sense and explains what I was seeing. Kinda like packing your chute as you jump out of a plane, I'd rather have it all packed first...
It's all working now, thank you!
-Larry
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only