Hello everybody,
i have a dataset with 2 datatables(master detail), a binding source(bs1) that has as datasource the dataset and as datamember the first table which is the master table. On the user control i use 3 datetime editors which has the property values set to the "bs1 - columnname". Also i have another bindingsource(bs2) which has as datasource the dataset but as datamember the detail table. The bs2 is used as the datasource of an ultragrid.
Everything is working but there is a problem, really strange one!
Now, i use this usercontrol on a form, and if i enter in edit mode in a particular column of the grid and then try to close the form i get ""Cannot bind to the property or column DATA on the datasource"".
What probably happens is that the BindingContext of the form is destroyed by the time the datetime control attempts to bind to it. Since there is no binding context, then the binding fails.
Any idea?
Thank you.
Hi,
I'm finding it really hard to follow exactly what's going on here just from your description. Is the grid inside the usercontrol on is it on the form separately as a sibling to the usercontrol?
When does the error occur? Why would the BindingContext be destroyed when you simply enter a value?
Perhaps you could post a small sample project demonstrating the error.
Hi Mike,
i cant reproduce this on a separate project. I'll try to explain better.
This is the form:
The red rectangle is the user control tha contains all the stuff at the same level. There is no other user control within this usercontrol, only infragistics components. The user control has only some public method which are called by the buttons on the ribbon. On the form there is no other logic.
The green rectangle is the master part. All the controls in this part are binded to the bs1 which has as datasource the dataset used by this uc and as datamemeber the master table.
The yellow rectangle is the detail part. The grid is inside a ultratabcontrol and has as datasource bs2.
bs2 has as datasource the same dataset used previously and as datamember a table that is a detail table.
Now where is the problem? The problem is that if i open this form, enter in edit mode on the cell indicated by the red arrow, and then close the form i get the error:
""Cannot bind to the property or column DATA on the datasource. Parameter name: dataMember"".
The control indicated by the blue arrow has the value = "bs1 - DATA" so this is the component that it is generating the error. In fact if i remove the binding i have no error!
if i'm on another cell of the grid and close the form i have no errors!!
You have wrote "When does the error occur? Why would the BindingContext be destroyed when you simply enter a value? ". I dont know Mike :) it was simply what i was thinking... :) I dont know if it is correct.