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

Failing inline updates, remove the update/cancel buttons

2 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jacob
Top achievements
Rank 1
Jacob asked on 23 Mar 2015, 09:46 AM
Hi,

MVC5, Inline editing:
When doing inline editing, the edit button is temporary replaced by two UPDATE/CANCEL buttons.
This is normal behavior.
If the update handling fails, then the update/cancel buttons is swapped back to the edit button, but the item itself, is still in edit mode.

I have attached the grid to the following events to be able to show messages to the user:
.Events(events => events.Sync("onSync"))
.Events(events => events.Error("onDataSourceError"))

I want the update/cancel buttons to be the visible one since it has failed and the user should still be able to correct the error and update again.
Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 25 Mar 2015, 07:30 AM
Hello Jacob,

You can handle the server side validation errors the same way as demonstrated in the following example in our CodeLibrary:


Regards,
Vladimir Iliev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Jacob
Top achievements
Rank 1
answered on 25 Mar 2015, 11:00 AM
So, the basic is to return the error like this:
return this.Json(new DataSourceResult
{
    Errors = ex.Message,
});
and cancel the ongoing process in the error event:
var grid = $("#" + gridname).data("kendoGrid");
grid.one("dataBinding", function (ee) {
    ee.preventDefault();   // cancel grid rebind if error occurs                            
})

Your sample use the ValidationMessage behavior and I'm also going to need help to that, because i can't get the Require attribute to work as usually - but that's going to be a new question :-)

Thanks.
Tags
Grid
Asked by
Jacob
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Jacob
Top achievements
Rank 1
Share this question
or