This question is locked. New answers and comments are not allowed.
Hi anybody,
I'm trying to create a CRUD Form for two Persistent Classes with a one to many relation (Parent/child relation) created in the DAL and mapped to database. For now I created a form with a bindingSource to manage CRUD operations in parent class and I binded radMaskedTextBox to the differents fields of Parent Class through the bindingsource. I set the bindingsource1.datasource = MyContext.MyParentClass.ToList<MyParentClass>();
Then, I added a RadDataGrid to manage Child Class:
when I move the parent bindingSource, the grid shows me the children objects correctly. My problem is when I try to add a new row in the grid, the foreing key field in the children object remains empty and also the reference to parent object. It's possible to link the child object to parent object when I add direcctly in the grid or datasource.
Thanks and sorry for my English.
I'm trying to create a CRUD Form for two Persistent Classes with a one to many relation (Parent/child relation) created in the DAL and mapped to database. For now I created a form with a bindingSource to manage CRUD operations in parent class and I binded radMaskedTextBox to the differents fields of Parent Class through the bindingsource. I set the bindingsource1.datasource = MyContext.MyParentClass.ToList<MyParentClass>();
Then, I added a RadDataGrid to manage Child Class:
BindingSource bs1 =
new
BindingSource(form.components);
bs1.DataSource = MyContext.GetAll<MyParentClass>().ToList<MyParentClass>();
BindingSource bs2 =
new
BindindSource(form.components);
bs2.DataSource = bs1;
bs2.DataMember =
"listOfChildrenObjects" //the field of the relation in the parent class
RadDataGrid grid =
new
RadData......;
grid.DataSource = bs2;
when I move the parent bindingSource, the grid shows me the children objects correctly. My problem is when I try to add a new row in the grid, the foreing key field in the children object remains empty and also the reference to parent object. It's possible to link the child object to parent object when I add direcctly in the grid or datasource.
Thanks and sorry for my English.