Hi,
I have a grid cell with an ultracombo set as the editor of that cell. If I use the ultracombo to select a different value, the CellChange event fires as expected. But when I inspect the value of the cell in the event handler, it's still set to the old value. I tried using the value of the editorcontrol but that throws an error because it's not in editmode by default.
How can I force the cell's value to always be in sync with the editorcontrol's value? I guess it has something to do with the editorcontrol not refreshing the cell's value untill it loses focus or something like that, but that kind of makes the CellChange event a bit hard to handle.
The reason Value is not updated is because while the cell is still in edit mode, the value may not be valid for the datatype of the column. For example, consider a DateTime column. If the user clears out the contents of a cell and types the number 1, this is not a valid date. The user may intend to enter "12/12/08", but CellChange will fire on every keystroke. So the grid cannot update the Value, because it's not a valid date, yet. So Value (which comes from the underlying data source) doesn't get updated until the user leaves the cell, when they are presumably finished editing.
I recommend using the Text property of the cell, which will be updated when CellChange fires.
It is probably a good idea to make extra conditions to the Update() call. Such as
if (someEventArgs.Cell.Column.ValueList != null)
private void GridCellChange(object aSender, CellEventArgs someEventArgs){
someEventArgs.Cell.Row.Update();
}