This is a migrated thread and some comments may be shown as answers.
e.OldData != e.NewData despite the same string value
2 Answers 5 Views
This is a migrated thread and some comments may be shown as answers.
Dexter
Top achievements
Rank 1
Dexter asked on 01 May 2014, 09:02 PM
Hello, basically in the event handler "CellEditEnded", I would like to check if the old cell value is the same as the new cell value.
e.OldData == e.NewData returns true if I completely don't touch the cell values.

However, if I for example, add something to the cell, and delete it again BACK to the same value, then e.OldData == e.NewData return false.
(Example - original value: test --> typed 's' to become 'tests' --> backspace again to become 'test' which is back to the same value.
Setting breakpoints does show that  e.OldData and e.NewData still have the same value, but somehow no longer equal.

e.OldData.ToString() and e.NewData.ToString() works, however, there will be exception if the column is binded to any non-string datatype (such as int / datetime etc). Is there any workaround for this? Thanks for your attention.

2 Answers, 1 is accepted

Sort by
0
Dexter
Top achievements
Rank 1
answered on 05 May 2014, 04:58 AM
Ups. Need advice on this.
0
Accepted
Nick
Telerik team
answered on 06 May 2014, 11:59 AM
Hi Dexter,

Have you tried using the Equals method of the objects in order to compare them? 
Do you get the same results? If that is the case, can you share a bit more info on your exact implementation? How are the Column bindings defined exactly? 

Looking forward to hearing from you. 

Regards,
Nik
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Asked by
Dexter
Top achievements
Rank 1
Answers by
Dexter
Top achievements
Rank 1
Nick
Telerik team
Share this question
or