Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
Using BindingContext object
Hi All:
I have a form with 2 business objects in use, one parent, one child. I designate the parent/child relationship in the DefineParticipatingObjects(). In the child business object, I have the AutoNewOnParentAdded property set to true. So everytime a parent is added, I want a child record added as well. All is good, so far. If I hit Add, both a parent and child record are added. I'm clearing the current parent dataset from within its business object HookPreAddNewRow() as follows:
protected override bool HookPreAddNewRow(DataTable dt)
{
OakLeaf.MM.Main.Data.mmDataSet ds = (OakLeaf.MM.Main.Data.mmDataSet)this.GetCurrentDataSet();
ds.Clear();
return true;
}
I tried doing the same thing for the child, but the call to get the current dataset on the child business object returned nothing. So I'm trying to use the BindingContext object in the HookPostNewRow() of the form, and I'm not having any luck either. Here is the statement issued in the HookPostNewRow() of the form, where oStYears is the child business object:
this.BindingContext[this.oStYears.GetCurrentDataSet()].Position =
this.oStYears.GetCurrentDataSet().Tables[0].Rows.Count -1;
I check the position of oStYears AFTER this statement, and it says that it is on the correct row, but my screen doesn't reflect that. I still see all the old values from the previous child record, not my newly added record.
Do I need to perform some type of object/screen refresh to see my newly added row after issuing the call to the BindingContext object? How can I navigate to my newly added row?
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement