I have two separate grids on my form, a parent grid and a child grid. The parent grid's data structure has an identity column and the child incorporates that field as part of its primary key. Both grid's datasources are pointed to bindingSources that point to ES collections.
When the parent record changes I load the corresponding child records.
Code:
//The parent record has changed. Load the new child details
User usr = new User();
usr = (User)userCollectionBindingSource.Current;
userCustomerLocationsCollection1 = usr.UserCustomerLocationsCollectionByUserId;
bindingSourceUserCustLocations.DataSource = userCustomerLocationsCollection1;
If I add a new parent record, its identity field is not set; when I move directly to the child record, how should I set the key field as the parent's value is not yet set. Is there a best method for doing this?