I have several cases where I'm using the CellChange event to react to changes in a grid, which usually involves updating another column in the grid. The problem I'm having is that if the user changes back to the original contents of the cell without leaving the cell (either by hitting the Esc key or reentering the original contents) the event doesn't fire and the other columns no longer show the correct information.
The workaround seems to be to use the KeyUp event, along with using the Cell.EditorResolved property to read the correct text out of the cell. It seems to be working, but I think it's a lot of effort to handle a fairly common scenario. I'm wondering if this is the intended behavior and if there's an easier way to do this.
Hi,
CellChange fires on every change to the text of a cell, it makes no difference what the original value was. Are you sure that the event is not firing? Perhaps your code is checking the current Text of the cell against the original value and that's why your code is not getting triggered.
If CellChange is, in fact, not firing when you change the text of the cell back to the original value, then that is clearly a bug.
Mike,
I've put Debug.WriteLine statements in the event handler and it's definitely not firing. We do have other event handlers that perform grid actions, and I'm trying to comment out as much of that as possible. However, one thing I noticed is that the AutoCompleteMode of the column has an effect. If I delete the last character (so that the text is no longer in the list) and then reenter it, the event does fire if the mode is set to None, but not if the mode is set to SuggestAppend. If I type another character that results in the text not being in the list the event does fire in either case. The event doesn't fire in either case if I use the Esc key to restore the value to one that's in the list. We're using 11.1 with the service release.
Hello,
I have created a sample, where I have UltraGrid and I am handle CellChange event, and I am not sure that I see your issue. Could you please run my sample and let me know the exact steps which I should follow, in order to reproduce your issue. Also, could you please let me know the exactly service release of 11.1 which you are using.
I am waiting for your response.
Hi Hristo,
I am able to demonstrate the problem with your sample program. After the form loads, I drop down the list and select Two; the CellChange event appears in the list box. If I then press the Esc key, the text changes back to One, but there is no event in the list. I've attached a screen copy.
The version of the UltraWinGrid assembly is 11.1.20111.2020.
Thank you for your feedback. Please let us know if you need any further assistance with this matter.
Thank you for using Infragistics Components.
The AfterCellCancelUpdate does solve the Esc key problem. Our other problems seem to have been caused by using SuggestAppend with a DropDown control. Changing the mode to Append seems to have solved our other problems and the functionality seems to be the same. I see now that the documentation does state that Suggest doesn't work with DropDowns, but perhaps something stronger than that would help (like an exception). Thanks for your help.
For the escape key, you can handle the AfterCellCancelUpdate event of the grid.