e.OldData != e.NewData despite the same string value

3 posts, 1 answers
  1. Dexter
    Dexter avatar
    34 posts
    Member since:
    Dec 2012

    Posted 01 May 2014 Link to this post

    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. Dexter
    Dexter avatar
    34 posts
    Member since:
    Dec 2012

    Posted 04 May 2014 Link to this post

    Ups. Need advice on this.
  3. Answer
    Nick
    Admin
    Nick avatar
    593 posts

    Posted 06 May 2014 Link to this post

    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.
     
Back to Top