Hi guys.
I have a wingrid with two related tables, and user can edit the value in second table.
The wingrid's UpdateMode is set to OnRowChangeOrLostFocus.
I edited a value in a cell, then it will fire CellChange event to do some calculation.
Unfortunately, when I look into the datasource of the wingrid, the value is not updated.
Please advice.
If I followed this correctly, you are interpreting the 'OnRowChangeOrLostFocus' setting as meaning that the data source is updated when a cell value in the row changes, but the term 'change' in that context means when the ActiveRow changes, i.e., when the user navigates to a different row.
You can get the behavior you are expecting here by setting UpdateMode to 'OnUpdate', and then calling the Update method in response to CellChange. This, however, is usually not a good idea because (a) it might cause performance issues since the data source is being updated continually and (b) you can't support rollbacks, like when the user presses escape to restore the previous value.
Note that the 'OnCellCHange' settings for UpdateMode will cause an update when the user leaves the cell, so you might want to consider using that.
Hi Brain, I took a look at my previous look and I found something.
In my previous work, the wingrid's datasource is datatable and works fine with UpdateMode 'OnRowChangeOrLostFocus', and the current wingrid that having problem is a dataset.
On current wingrid, I only can get previous modification/update from the dataset after second modification/update.
Hi Brian, thanks for your reply.
I tried to set the UpdateMode to OnUpdate, but what I got is that only the previous cell is updated into the dataset of the wingrid.
And in the wingrid.CellChange event, I use e.Cell.Row.Cells("a").DataChanged for both cell. But everytime I edited the entry in any of the cell, I got both cell's DataChanged = True.
Please help.