When performing a RowUpdate I update information to reflect the last change and the person who did so. However, I only want to do so if a change has actually been made.
I do not see a way to do this other than to compare the old and new e value for each field.
More of a problem, is when I do so on a field with a SpinEdit that allows Nulls, without doing any editing the new value compares as "Nothing" and the old value as "System.DBNull."
I would have thought that the old and new values would be the same without any editing. Is that not the case, and is there an easier way to know if a row has changed than comparing each field?
ASPxGridView - How to compare old and new values
Answers
Hello Larry,
Thank you for your question. In fact, you can compare old and new values in the ASPxGridView.RowUpdating event handler if you loop through the e.OldValues dictionary, then extract the Key value of each item and then search for an appropriate value in the e.NewValues dictionary.
> More of a problem, is when I do so on a field with a SpinEdit that allows Nulls, without doing any editing the new value compares as "Nothing" and the old value as "System.DBNull."
The ASPxSpinEdit control works with the Decimal type (the type of the ASPxSpinEdit.Number property) that does not work with the System.DBNull value. If you need to convert from the Nothing/Null value to the DBNull value, you should use the following code:
Visual BasicIf (e.NewValue(...) = Nothing) Then
e.NewValue(...) = System.DBNull
End If
Thanks,
Vest