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

Add New Record - Grid data row shows change, even if .AddModelError is called

1 Answer 22 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 18 Nov 2013, 04:01 PM
I am using the MVC wrappers.  When I do an "Add new record", if there is a server-side validation error (ModelState.AddModelError(...), the grid still shows the row that I was attempting to add.  This occurs whether I am in server-side paging or not (both ways, .ServerOperation).  Doing an <F5> on the page restores things to correct state, but I don't think it is appropriate to put this responsibility on the user.  Is there some setting I can use, or someway to refresh the grid on a failed Create (or Update - happens there too)?

Thanks,
R Cornish

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 20 Nov 2013, 12:44 PM
Hello,

If you wish to remove the new record when there are errors on the server then you should call the cancelChanges method in the error event. You could also leave the row in edit mode and show the message from the server, as demonstrated in this code-library project.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Randy
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or