I have 2 classes i.e CustomerOrder
and Customer
class
has a reference to a collection of orders.
I use master detail BindingSource
s.
My problem is when I use the lazy load pattern
for orders my detail BindingSource
is not updated.
UI
BindingSource1.datasource = GetCustomers();
BindingSource2.DataMember = "Orders";
BindingSource2.datasource = BindingsSource1;
So in my datagridView1
Click event
if (customer.orders != null)
{
customer.Orders = LoadOrders();
}
I appreciate any help with this.
Try reseting the binding:
BindingSource1.DataSource = GetCustomers();
BindingSource2.DataMember = "Orders";
BindingSource2.DataSource = BindingSource1;
BindingSource2.ResetBindings(true);