I've just upgraded my winforms controls from v8.2 to v12.1. Since the upgrade, some cells in the UltraGrid are not behaving correctly.
When I paste a valid value into them, they display just fine, until I tab out of it, in which case it loses its value.
The cells in question have a dropdown control on them. Not all cells with dropdowns have this issue though. As best as I can tell, the only real difference between the dropdown cells that work fine, and the ones that do not, is the ones that do not have the datatype string behind them, while those that work fine have the datatype of int behind them.
What could be causing this?
A little more information - if the string dropdown already has a value in it, then paste works fine. Its only if it initially has a value of null that causes problems.
--- EDIT ---
Bit more information. The CellChange event does not fire if the cell is a blank string in it originally. But after it has a value (by selecting from the dropdown) it fires fine.
Thanks.
Can you tell me what the likely result of this is? Will there be a patch?
Hello,
I have created CAS-115946-M4P3W4 to track this issue and I've also submitted the issue to engineering for them to research.
Hi,
I tried this out and I get the same results. It's very strange, because if I cache the UltraDropDown once and then assign it in in the InitializeRow, it was working.
But there is clearly a problem here beyond that. So I've forward this thread over to Infragistics Developer Support and asked them to create a case for you and write this up for developer review.
Yes, there is a reason I use the InitializeRow event to set some dropdowns, because the value of the list depends on other values in the row, which may change. But what you see in this sample app is very different to the live app. In the live app, a list of possible dropdowns is maintained, and the dropdown is only changed if the correct one is not assigned. So the dropdown is not constantly changing - its just being set in the InitializeRow event.
To more closely simulate this, you can changethe InitializeRow event as follows:
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { if (e.Row.Cells["StrColumn"].ValueList == null) e.Row.Cells["StrColumn"].ValueList = strLookupMngt.CreateDropdown(); }
For me, the issue still occurs if I do this.
To take it one step further, and only use the InitializeLayout event, like this:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { ultraGrid1.DisplayLayout.Bands[0].Columns["IntColumn"].ValueList = intLookupMngt.CreateDropdown(); ultraGrid1.DisplayLayout.Bands[0].Columns["StrColumn"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend; ultraGrid1.DisplayLayout.Bands[0].Columns["StrColumn"].ValueList = strLookupMngt.CreateDropdown(); }
While the InitializeRow event does nothing. I still get the issue.
I'm not exactly sure why, but the problem in your sample is here:
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { e.Row.Cells["StrColumn"].ValueList = strLookupMngt.CreateDropdown(); }
This is bad for a number of reasons. For one thing, this is extremely inefficient. This event fires every time any cell value in any row changes. So you are unnecessarily creating and recreating the a new UltraDropDown control with the same data for every row multiple times.
And, if the inefficiency is not bad enough, setting the UltraDropDown over and over is what's causing the cell to blank out. My guess is that there's some kind of timing problem here where the grid is trying to match up the text to something on the list and it can't because the list has changed in the middle of the process.
If I change your sample to create the DropDown once and assign it to the cell once, it works fine.
I assume that, in your real app) you are assigning a dropdown to the cell instead of the column for a reason. So you probably need to use InitializeRow. But you should not be creating a new UltraDropDown control every time. Instead, it would be best to cache the UltraDropDown and re-use the same one. And, in fact, you could re-use the same UltraDropDown for all the cells that need to show the same list - you don't need one for every cell.