Failing inline updates, remove the update/cancel buttons

3 posts, 1 answers
  1. Jacob
    Jacob avatar
    45 posts
    Member since:
    Sep 2014

    Posted 23 Mar 2015 Link to this post


    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.
  2. Answer
    Vladimir Iliev
    Vladimir Iliev avatar
    2206 posts

    Posted 25 Mar 2015 Link to this post

    Hello Jacob,

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

    Vladimir Iliev

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

  3. Jacob
    Jacob avatar
    45 posts
    Member since:
    Sep 2014

    Posted 25 Mar 2015 in reply to Vladimir Iliev Link to this post

    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");"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 :-)

Back to Top