Hi,
Need some help on this problem that have bedevil my work for the late two days.
I'm developing an application using the EF 4.3 w/ DbContext DbSet, created three entities Taxpayer TaxType and EconomicActivity
there are one-to many relationships betwwen Taxpayer TaxType on the one hand and Taxpyer EconomicActivity on the other. using a foriegn key TaxpayerID created a navigiation properties TaxTypes and EconomicActivities as part of the taxpayer entity. I created a UI with winform which consisted of textboxes, comboboxes and others for the Taxpayer entity that is working very well. For the navigation properties EconomicActivies and TaxTypes, the user requirement is that all the details are list in a datagridview and there should have textboxes and other controls to edit and add new details info for taxtypes and EconomicActivities. I added these controls and bind them and the datagridview using bindingsource component and notice that when there are already existing taxtypes the form loads successfullyand the user can add more taxtypes, the same for economicActivities too. However, when there is no record existing for the taxtype and the user try loading the form during the binding of the bindingsource to the controls apart from the datagridview it gives and error
"Cannot bind to the property or column of the Datasource Parameter: datamember.
below is the linq query to load the data for the taxpayer and their respective taxtypes and EconomicActivities
_ctx.TaxPayerInitialCorporates.Include("EconomicActivities").Include("TaxTypes).Load()
A workarround I'm doing is to clear the binding from all the controls when navigation property count is zero and set a flag and where the user when to add new rebinding each control after creating new taxtype entity on request to add new, which I think is not the best solution
Your help will be very muc apprieciated