开发者

Telerik MVC Grid submitChanges function return value

开发者 https://www.devze.com 2023-03-27 06:35 出处:网络
we are usingsubmitChanges 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?

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?

$('开发者_StackOverflow社区#Grid).data('tGrid').submitChanges(); ok.
var ret = $('#Grid).data('tGrid').submitChanges(); // ok but ret is undefined


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

0

精彩评论

暂无评论...
验证码 换一张
取 消