This is a migrated thread and some comments may be shown as answers.

Delete a Row During/After Validation

1 Answer 55 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 2
Aaron asked on 14 Sep 2014, 02:19 PM
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

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 17 Sep 2014, 02:53 PM
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.
 
Tags
GridView
Asked by
Aaron
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Share this question
or