Hi,
I have an UltraCombo that is used to select items from a list and set a cell value back in the grid. The grid is bound to a List<MyBusinessObject> data source.
However, the cell is not updated until the user navigates off it where AfterCellUpdate. I want to update the cell/data source immediately at the point the user has selected a value.
What is the best way to do this?
Thanks,
Andez
Hello Andez,
I am glad we were able to assist you. Please let us know if you have any additional questions.
Hi Mike,
Indeed, AfterCellListCloseUp is what I was after.
Thanks
Hi Andez,
If the Combo is outside the grid, that will work. But if you are embedding the combo inside the grid cell via the Editor, EditorComponent, or ValueList property on the column or cell, then you might be better off using a grid event like AfterCellListCloseUp or CellChange. You have to be careful, though, as CellChange will fire when the user types into any cell. So they could be in the process of typing something and the partial value might not be valid. So you probably want to limit this to only the Combo column and only when the text in the cell matches an item on the list.
Apologies, yes. Update the ListObject.
I guess I wanted pointers on how to do this.
I am handling the ValueChanged event of the combo and calling the grid.UpdateData method. It works :)
Cheers
I'm pretty sure I understood the question the first time. But this clarification has me confused. You want to update the ListObject but you don't want to update the ListObject?
When you drop down the list in the cell and select an item, the cell's Text is updated. The underlying ListObject is not updated until you leave the cell or the grid loses focus (based on the UpdateMode property). If you want to write the changes from the cell to the ListObject, there are two ways to do that. One is to call the Update method on the row. This is essentially what happens when you leave the cell or lose focus on the grid, so that's what I suggested you do to achieve what you want.
The only other alternative would be to set the value on the ListObject yourself. You could get the row's ListObject property cast it to the appropriate type and then directly set the appropriate property. This second approach is tricky and I'm not sure it will work very well, as you may run into timing issues or conflicts with the grid.