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.
Mike Saltzman"]What I mean by this is... are you setting the DataMember and DisplayMember property on the UltraDropDown to two different columns (or to the same column, for that matter). These allow you to store one value (DataMember) while displaying some more user-friendly text (DisplayMember) to the user.
OK. Yes I am. I'm setting them both to the same property of the lookup dataitme.
Mike Saltzman"]Without seeing the behavior occur, it's hard to say. I would start with the BeforeMultiCellOperation event. This is the event that fires when you paste multiple cells in the grid. There's also an AfterMultiCellOperation, but I'm not sure that's helpful here.
The BeforeMultiCellOperation is not being fired. Keep in mind, I am pasting only into a single cell. Should it be getting fired?
Hi,
fweeee said:I dont understand the bit about translating DataValues into DisplayValues.
What I mean by this is... are you setting the DataMember and DisplayMember property on the UltraDropDown to two different columns (or to the same column, for that matter). These allow you to store one value (DataMember) while displaying some more user-friendly text (DisplayMember) to the user.
fweeee said:Can you give me a hint at what I should be looking for? Is there some sort of cancel update or something that I could be calling somewhere that is causing this?
Without seeing the behavior occur, it's hard to say. I would start with the BeforeMultiCellOperation event. This is the event that fires when you paste multiple cells in the grid. There's also an AfterMultiCellOperation, but I'm not sure that's helpful here.
It is an UltraDropDown, which I am programatically assigning to the ValueList, like so:
ultraGrid.DisplayLayout.Bands[0].Columns["ColumnName"].ValueList = Brandmngt.CreateDropDown(jobItemGridValidationMngt.DropDownSelectedmngt, null, true, true);
The Brandmngt class is one that I use on numerous forms, where I need to generate this dropdown. It reads data from the database, formats the dropdown, add required events, etc.
Yes - only for the string columns, and only if they are currently null.
I dont understand the bit about translating DataValues into DisplayValues.
I have tried to reproduce the problem in a small sample project, but could not. It worked as you would expect there.
Another thing I have just found. I just tried pasting in an invalid value, and it displayed. When I left the field, it ran the code I wrote to handle this (in the grids BeforeCellUpdate event). But when I paste a value into it, the BeforeCellUpdate event is not triggered.
Its looking like some of my other code (in the grid management/validation side ofthings) is suppressing these events. I'm going to have to try delving through that. Its frustrating that this is happening - that the behaviour of the grid has changed so that it breaks old code.
Nope. Cant find anything. Neither the AfterCellUpdate nor the CellChange events are firing.
Can you give me a hint at what I should be looking for? Is there some sort of cancel update or something that I could be calling somewhere that is causing this?
What kind of DropDown is in the cell? Is it a ValueList or an UltraDropDown?
You say that this only happens if the DataType of the grid column is string and the field is initially null?
Is the dropdown translating DataValues into DisplayValues?
Can you duplicate the issue in a small sample project and post it here so we can check it out? I tried creating a sample, but there are just too many unknowns for me to get it right.