2
votes

we are using submitChanges function for submit changes to the controller from grid. but we hoped but function returned value. does anybody know how can we get returned value or a trick?

$('#Grid).data('tGrid').submitChanges(); ok.
var ret = $('#Grid).data('tGrid').submitChanges(); // ok but ret is undefined
1

1 Answers

1
votes

I am not sure but I use the onError event callback to know what went wrong. I am not sure whether it will work in your case but nevertheless I am pasting sample code.

 function onGridError(args) {
   if (args.textStatus == "modelstateerror" && args.modelState) {
        var message = "Errors:\n";
        $.each(args.modelState, function (key, value) {
            if ('errors' in value) {
                $.each(value.errors, function () {
                    message += this + "\n";
                    alert(key)
                });
            }
        });
        alert(message);
    }
    else {
        alert("The server was unable to process your request.\n" + args.XMLHttpRequest.responseText);
    }
    args.preventDefault();
}

regards, Nirvan