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.
Hi,
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.
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?
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.
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 Harshit,
I replied to this question on Wednesday here.
Hi Mike,
I have implemented Ultradropdown in my wingrid and it is working perfectly fine. The issue occurs when I copy an alphanumeric/numeric value and paste it into the ultradropdown box, it pops up the error message [Unable to convert from "System.String" to "System.DateTime"]. I tried to debug the code but I was unable to find from where this message is getting triggered.
Please note that it is not a date-time type text box and there is no error message when I paste an alphabetical value. Also, after this error message, the value gets entered (pasted) as expected. It's just that I need to modify this message to some user friendly message like "copy/paste is not allowed for this field".
Kindly help me out.
Thanks,Harshit
Hello,
This issue has been addressed in service release versions WinForms_13.1.20131.2040, WinForms_12.2.20122.2087.
I can't say for certain until we've looked into it. But in my opinion, this looks like a bug and it will probably be fixed in an upcoming service release. If, for some reason, a fix is not feasible, then we would at least try to provide you with a reasonable workaround.