I have a few UltraComboEditor using complex databinding on a form, and the DataSource of these editors changes based on some other entries on the form. The Value property (for SelectedItem) in these editors are also data-bound through simple databinding.
The problem is that whenever the underlying DataSource changes for these UltraComboEditor, I receive "This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row." exception. The stack trace is below:
at System.Data.DataRow.GetDefaultRecord() at System.Data.DataRow.GetRecordFromVersion(DataRowVersion version) at System.Data.DataRow.get_Item(DataColumn column, DataRowVersion version) at System.Data.DataRowView.GetColumnValue(DataColumn column) at System.Data.DataColumnPropertyDescriptor.GetValue(Object component) at Infragistics.Win.BindableValueList.GetBoundValueHelper(ValueListItem item, String propertyName) at Infragistics.Win.BindableValueList.GetBoundDataValue(ValueListItem item) at Infragistics.Win.ValueListItem.get_DataValue() at Infragistics.Win.UltraWinEditors.UltraComboEditor.HasSelectedItemDataValueChanged(Int32 lastSelectedIndex) at Infragistics.Win.UltraWinEditors.UltraComboEditor.OnValueChanged(EventArgs args) at Infragistics.Win.UltraWinEditors.TextEditorControlBase.OnValueChanged(Object sender, EventArgs args) at Infragistics.Win.EmbeddableEditorBase.RaiseValueChangedEvent() at Infragistics.Win.EditorWithCombo.Infragistics.Win.IValueListOwner.OnSelectedItemChanged() at Infragistics.Win.ValueList.ProcessSelectedIndexChanged(Int32 selectedIndex, Boolean commit) at Infragistics.Win.ValueList.set_SelectedIndex(Int32 value) at Infragistics.Win.BindableValueList.Bind() at Infragistics.Win.BindableValueList.RefreshDataItems() at Infragistics.Win.UltraWinEditors.UltraComboEditor.DataBind()
It seems to me that when the underlying DataSource is refreshed, the UltraComboEditor raises SelectedItemChanged event, but as it cannot find the original ValueListItem, it generates the exception.
My question: is it possible to prevent SelectedItemChanged event from firing when the DataSource is being refreshed? Is there a recommended procedure on refreshing the DataSource for UltraComboEditor?
I am using v2007.1.
Thanks.
This sounds like a bug that was fixed a while ago. Do you have the latest Hot Fix? If not, I recommend downloading it.
After upgrading to the latest version (8.1 with SP1), I got a different error in code that used to work.
"Object reference not set to an instance of an object. (System.Data)"
at System.Data.DataView.IsOriginalVersion(Int32 index) at System.Data.DataRowView.GetColumnValue(DataColumn column)at System.Data.DataColumnPropertyDescriptor.GetValue(Object component)at Infragistics.Win.BindableValueList.GetBoundValueHelper(ValueListItem item, String propertyName)at Infragistics.Win.BindableValueList.GetBoundDataValue(ValueListItem item) at Infragistics.Win.ValueListItem.get_DataValue()at Infragistics.Win.ValueListItemsCollection.RemoveInternal(ValueListItem item)at Infragistics.Win.BindableValueList.Bind()at Infragistics.Win.BindableValueList.VerifyItems()at Infragistics.Win.ValueList.GetValueListItems(Boolean allocateIfNecessary)at Infragistics.Win.ValueList.get_ValueListItems()at Infragistics.Win.ValueListItemMetrics.InitializeValueListItemsSizeCache(Boolean rebuild)at Infragistics.Win.ValueListItemMetrics.OnValueListItemsCollectionContentsChanged(Object sender, ValueListChangedEventArgs e)at Infragistics.Win.ValueList.FireListChanged(ValueListChangedEventArgs args)at Infragistics.Win.BindableValueList.OnBindingListChanged(Object sender, ListChangedEventArgs e)at System.ComponentModel.ListChangedEventHandler.Invoke(Object sender, ListChangedEventArgs e)at System.Data.DataView.OnListChanged(ListChangedEventArgs e)at System.Data.DataView.IndexListChanged(Object sender, ListChangedEventArgs e)at System.Data.DataViewListener.IndexListChanged(Object sender, ListChangedEventArgs e)at System.Data.Index.OnListChanged(ListChangedEventArgs e)at System.Data.DataTable.ResetInternalIndexes()at System.Data.DataTable.Clear(Boolean clearAll)at System.Data.DataTable.Clear()at DAL.LoadTable(String id, String filter)
This happens when data layer is trying to refresh the underlying data table which is bound to an UltraComboEditor.
Please advise.
Hi,
It appears to be blowing up inside the DataView when the Combo is asking for the value of an item. I'm not sure why that would be. The only explanation that comes to mind is that your code is using multiple threads and the combo is trying to access the data source with it is in a bad state because there is processing occurring on a different thread.
If that's not the case, then I'm not sure why this is happening. If you can duplicate the exception in a small sample project, you should Submit an incident to Infragistics Developer Support so they can check it out.
The only other thread in the application would be the one that performs simple DataBinding. The weird thing is that this module at least worked in v7.1, but only breaks after I upgraded to v8.1.
It will take some time to create a small sample project because of the binding code involved. Will try to do it after I deliver the current project.