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.
The problem is that i'm not able to reproduce this on a new solution.
If it can help, i have the same problem on another form but this time is not an ultradatetimeditori instead it is an ultratexteditor.
Here is the stack http://www.evald.eu/public/longstackUltraTextEditor.txt
It's very tough to tell and there's a lot going on here.
It looks like maybe the DataSource is getting disposed first, and then the UserControl, and at this point the form is trying to set focus to the DateTimeEditor, which then tries to access the DataSource, which is no longer there. Or something sort've along those lines.
This could be a bug in the DateTimeEditor, because it looks like it's trying to determine if it is HotTracking while this is going on. But there's really not much we can do to fix this without being able to duplicate it. If you can whip up a small sample project that demonstrates this, we would be more than happy to check it out.
In the mean time, it sounds like your solution is a good one.
a little update:
for now i have solved, clearing the databinding on the dispose method. ultraDateTimeEditorPartitaData.DataBindings.Clear();
yes, the grid and the other controls on the form are bound to two different tables and that is why i think this is a strange error.
It throws an argumentexception and here it is the stack!
and here you can find the complete stack trace with the [External code] http://www.evald.eu/public/longstack.txt
I believe its a problem with UltraDateTimeEditor because this strange problem occurs also on another application that is using the UltraDateTimeEdito.
ps:Mike, thank you for your time!
Hi,
If the grid and the other controls on the form are bound to two different tables, then I can't see why this would cause a problem of any kind.
Is the error an exception? Is there a call stack? Or is it just a MessageBox? If there's a call stack, please post it here and maybe that will give us some clue about what's causing this.
If it's just a MessageBox, then try trapping the grid's CellDataError and Error events and see if one or the other is firing. If so, there will be a call stack showing how the event was triggered and that might help.
Another thing you might want to try, just to see if this is even related to the grid at all, is to try using the DataGridView in place of the UltraWinGrid and see if the error still happens. My guess is that this error is not specific to the grid, but is rather some weird binding issue.