Delete a Row During/After Validation

2 posts, 0 answers
  1. Aaron
    Aaron avatar
    38 posts
    Member since:
    Apr 2008

    Posted 14 Sep 2014 Link to this post

    During row validation I am checking to see if the row is a duplicate of another row in the GridView. If it is a duplicate, I set IsValid to false.

    In RowEditEnded, I only save the underlying entity back to the database if row.IsValid == true.

    However, the duplicate row still hangs out in the GridView.  Additionally, if they close the Window and re-open it, the duplicate row is still there (it's a detached entity) even though it hasn't been persisted to the database.  The duplicate row only disappears when the close the appellation and re-launch it.

    I could remove all detached entities when the window is closing, but I'm hoping I can just remove the duplicate row in the RowValidating or RowValidated event handlers.

    Any suggestions?

    Thanks.

    Aaron
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 17 Sep 2014 Link to this post

    Hi Aaron,

    As you say you only save the distinct values to the database, generally RadGridView will not replace its items until a new query to the server is executed and all the data is fetched again. 

    Basically you could hide particular rows by adding a FilterDescriptor that filters your items by a certain criteria (in your case you need to have such a boolean property). You can then define the Filtering criteria as explained in the Programmatic Filtering article. As another example, you can check the "Programmatic Filtering" WPF Demo

    Regards,
    Dimitrina
    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