开发者

Telerik MVC Grid submitChanges function return value

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜