New Visual Studio 2010 WinForms C# project and imported existing form containing IG 2009 controls, which were updated to NetAdvantage 2011.
Our practice and existing code would always first our UltraCombo's datasource = null; before setting the datasource = datatable object returned from a SQL procedure call.
I was shocked to see that if the UltraCombo was already bound to a datatable, the calling of the same method to set a datasource is firing the RowSelected event of the combo when combo.datasource = null; is executed!
Needless to say, this is wreaking havoc in the project and we're looking for direction.
Is this a bug or something new in 2011??
Thanks!
Hi,
I tried this out and I am not seeing this behavior. If I have an UltraCombo with a selected row and I set the DataSource to null, RowSelected does not fire at that point. It does fire when I set the DataSource to something new, though - if the same value it previously had matches up to something on the new list.
This is correct behavior, since the actual Row object is different, even though the Value and text are the same.
I am attaching my sample project here so you can check it out. If I run the sample and click the button, the RowSelected event does not fire. This is correct, since there was no selected row to start with and changing the DataSource has no effect on that.
If I select a row and then click the button, the RowSelected event fires once. This is also correct since the original selected row was destroyed and a new row was created which happens to match the existing Value of the control (the Key field).
Hi Mike,
Thank you for the response and code. More specifically, I have 4 combo controls. I will refer to them as c1, c2, c3... Some event sets c1's datasource = datatable. The row selected event on all of the combos is set to load a datatable to the next combo in-line. This code has been in Production for several months, again as a Visual Studio 2008 project and NetAdvantage 9.
Workflow: User selects a value from c1 and a method is called from c1’s row selected event to set c2, c3 and c4’s datasource to null (to clear them) then c2’s datasource to a new datatable relevant to the value selected in C1. User then selects a value from c2 and c2’s row selected event calls a method to set c3 and c4’s datasource to null, then c3’s datasource is set to a new datatable, etc. The user can elect to have values selected in just c1 or all 4 combos. It depends on the amount of filtering they want to set for an eventual button click to return data to a grid.
So it appears that the row selected event does not automatically fire when the combo's datasource is set in version 9, but now does in v 2011? If this isn’t the case, I am willing to concede that I have no clue how to properly code this workflow. Again, what I have has been working perfectly in the Visual Studio 2008 project with 9.2 controls. I cannot get it to work the same in Visual Studio 2010 and 2011 controls. My latest iteration is leaving each combo with the previously selected value regardless of what value they select. It has been one of those weeks... :(