hi,
I have a problem with the grid updatemode. No matter what I set the mode as, the underlying datatable still get updated as soon as cell update event.
what i need to do :-
compare the value of columns before and after row update.
cannot do this in cell update event because i need to compare multiple columns at one time.
cannot use cell original value because it always keep the last value changed, not the most current value before row update.
tried to use before row update, but no idea how to get the respective cells value before the update
any idea ?
thanks
Hi,
I'm sorry, I think I misunderstood the issue. The behavior you are getting here is correct. The UpdateMode property controls when the grid calls EndEdit and thus commits the changes into the row. But the values of each field as still written to the data source when you leave a cell.
If you want to get the original values from the rows, you can use the DataTable's GetChanges method.
Thanks, attached is my sample project
Test steps:
change row 1 column 1 value to 1
change row 1 column 2 value to 2
click on next row. beforerowupdate event firing up.
msgbox shown updated value in datatable in beforerowupdate event.
I tested this out and it works fine for me. Can you provide a small sample project demonstrating the issue you are experiencing? Perhaps something else in your application is forcing an update.
Hi Mike,
It is not working, the datatable or the listobject already been changed even set to rowchange mode.
If you set UpdateMode to OnRowChange or OnRowChangeOrLostFocus, then you could use BeforeRowUpdate to compare the values in the cells to the values in the underlying data source.
To get the object in the data source that the grid row represents, you use the ListObject property on the row. If you are using a DataTable, then the ListObject property will return a DataRowView, which has a Row property on it, so you can get the DataRow and examine it's data and compare that to the Value of the cells in the grid row.