Hi,
I am using a Form with 2 UltraCombos in which second combo Value will set based on First Combo's Selected Value
But, when I try to do this , Second Combo Value gets Updated based on First Combo's Drop down row Selection , but I am not able to Get the Selected Row to show up in the First Combo Box text Editor, (i.e., Selected row Displaymember in the Dropdown is not reflecting in the Editor Textbox )
I have tried using both combo.SyncWithManager with true and False, but didn't help,
Herewith, I have attached the sample also for your Understanding,
Pls advice me where I am doing wrong in the sample, But when I try to do the same with Windows ComboBox it is working fine
Awaiting your Advice ,
Thanks and Regards,
Ganesh
Hi Lava,
I'm not really sure what you mean. Why can't you see the values? Anyway, this doesn't seem to be related to this thread, so I suggest you start a new thread and explain exactly what you are seeing with some screen shots or maybe a sample so we can provide you with assistance.
Hi Mike ,
i am having an issue with Ultra combo after upgrading the infragistics controls from 14.2 to 15.2 , the combo value is messed up & we are not able to see the values completely i.e only some part of it we can see , i tried changing the properties of the columns inside the ultra combo but it is not working completely ,like i am still unable to see the complete values of the combo .
Hi Ganesh,
The only other way I can think of to work around this would be not to bind the edit portions of the controls and to update them manually.
Unfortunately, this appears to simply be a quirk of the DotNet Framework's DataBinding.
I don't know if there is anything useful there, but you might want to take a look at the properties on the Binding object. Perhaps there is some setting there that allows you to change this behavior. I doubt it, but it's worth looking into.
Hi Mike,
Thanks for the Reply,
Is there any workaround or any fixes available to make the control compatible while working with DataBinding, so that we don't have to Explicitly Update the DataSource, because we need to write these for all the UltraCombo Value Changed event where ever these kind of Scenario comes,
Awaiting your advice,
If you put a breakpoint in the cmbCountry_ValueChanged event and then run the application and select an item from the Country list, you will see that the event fires, just as it should. But if you then step through the code line by line, when you get to the line:
cmbState.Value = 2;
When you step past this line, the code come back into the event a second time. Looking at the call stack, it looks like this:
> UltraComboSample.exe!UltraComboSample.Form1.cmbCountry_ValueChanged(object sender = {Infragistics.Win.UltraWinGrid.UltraCombo}, System.EventArgs e = {System.EventArgs}) Line 51 C# [Native to Managed Transition] [Managed to Native Transition] Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.OnValueChanged(System.EventArgs e = {System.EventArgs}) Line 10479 + 0x11 bytes C# Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.FireEvent(Infragistics.Win.UltraWinGrid.ComboEventIds id = ValueChanged, System.EventArgs e = {System.EventArgs}) Line 9964 + 0xe bytes C# Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.FireValueChangedEventHelper(bool hasChanged = true, object newValue = 1) Line 12593 + 0x25 bytes C# Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.SelectedItemChangeHelper(Infragistics.Win.UltraWinGrid.ComboSelectedItemChangeContext context = Value, object newData = 1) Line 12573 + 0x14 bytes C# Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.Value.set(object value = 1) Line 7784 + 0x13 bytes C# [Native to Managed Transition] [Managed to Native Transition] System.dll!System.ComponentModel.ReflectPropertyDescriptor.SetValue(object component = {Infragistics.Win.UltraWinGrid.UltraCombo}, object value = 1) + 0x124 bytes System.Windows.Forms.dll!System.Windows.Forms.Binding.SetPropValue(object value) + 0xcf bytes System.Windows.Forms.dll!System.Windows.Forms.Binding.PushData(bool force) + 0x7c bytes System.Windows.Forms.dll!System.Windows.Forms.BindingManagerBase.PushData(out bool success = true) + 0x51 bytes System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.CurrencyManager_PushData() + 0x4f bytes System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.OnItemChanged(System.Windows.Forms.ItemChangedEventArgs e = {Index = 0}) + 0x5e bytes System.Windows.Forms.dll!System.Windows.Forms.CurrencyManager.List_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) + 0x3d9 bytes System.Windows.Forms.dll!System.Windows.Forms.BindingSource.OnListChanged(System.ComponentModel.ListChangedEventArgs e) + 0x7e bytes System.Windows.Forms.dll!System.Windows.Forms.BindingSource.ListItem_PropertyChanged(object sender, System.EventArgs e) + 0x49 bytes System.dll!System.ComponentModel.PropertyDescriptor.OnValueChanged(object component, System.EventArgs e) + 0x51 bytes System.dll!System.ComponentModel.ReflectPropertyDescriptor.OnValueChanged(object component, System.EventArgs e) + 0x65 bytes System.dll!System.ComponentModel.ReflectPropertyDescriptor.SetValue(object component = {UltraComboSample.Address}, object value = 2) + 0x140 bytes System.Windows.Forms.dll!System.Windows.Forms.BindToObject.SetValue(object value) + 0x5d bytes System.Windows.Forms.dll!System.Windows.Forms.Binding.PullData(bool reformat, bool force) + 0x15a bytes System.Windows.Forms.dll!System.Windows.Forms.Binding.Target_PropertyChanged(object sender, System.EventArgs e) + 0x29 bytes [Native to Managed Transition] [Managed to Native Transition] Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.OnValueChanged(System.EventArgs e = {System.EventArgs}) Line 10479 + 0x11 bytes C# Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.FireEvent(Infragistics.Win.UltraWinGrid.ComboEventIds id = ValueChanged, System.EventArgs e = {System.EventArgs}) Line 9964 + 0xe bytes C# Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.FireValueChangedEventHelper(bool hasChanged = true, object newValue = 2) Line 12593 + 0x25 bytes C# Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.SelectedItemChangeHelper(Infragistics.Win.UltraWinGrid.ComboSelectedItemChangeContext context = Value, object newData = 2) Line 12573 + 0x14 bytes C# Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.Value.set(object value = 2) Line 7784 + 0x13 bytes C# UltraComboSample.exe!UltraComboSample.Form1.cmbCountry_ValueChanged(object sender = {Infragistics.Win.UltraWinGrid.UltraCombo}, System.EventArgs e = {System.EventArgs}) Line 52 + 0x36 bytes C# [Native to Managed Transition] [Managed to Native Transition] Infragistics2.Win.UltraWinGrid.v9.2.dll!Infragistics.Win.UltraWinGrid.UltraCombo.OnValueChanged(System.EventArgs e = {System.EventArgs}) Line 10479 + 0x11 bytes C#
So the ValueChanged event fires once, and the code sets the Value of the second Combo. The Binding on the Combo is tracking this and it updates the field in the data source, which then triggers a ListChanged notification. The currencyManager responds to this by pushing the data out to all bound controls. Since both combos are bound to the same data source, the country combo gets set back to the original value, which hasn't yet been updated in the data source.
So the problem is that the Binding is not updating the data with the new Country value until after the ValueChanged event has completed. In fact, I think it might not update it until the control loses focus. So one thing you could do is use the ValueChanged event to first update the actual field in the data source before you set the value on the state combo. It kinda defeats the purpose of Binding, but in my experience, the DataBinding behavior has lots of little quirks like this and you might be better off avoiding binding directly, anyway.
Another option might be to call the BindingManager.EndCurrentEdit inside ValueChanged before you set the State combo's Value. This is essentially the same thing, except it lets the BindingManager set the Country value rather than you doing it yourself.