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

[Solved] Grid OnError can't not access modelState

0 Answers 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
yiming
Top achievements
Rank 1
yiming asked on 08 Jun 2011, 09:04 PM
Here is the sample code:
function Grid_onError(args) {
    if (args.textStatus == "modelstateerror" && args.modelState) {
        var message = "Error: \n";
        $.each(args.modelState, function (key, value) {
            if ('errors' in value) {
                $.each(value.errors, function () {
                    message += this + "\n";
                });
            
        }); 
        args.preventDefault();
        alert(message);
    }
}

My issue is while running on $.each(args.modelState, function (key, value) {
it just skip code inside $.each
args.modelState definite have errors, on firebug:

args.modelState: 
Objectinserted[0].anaes_flag: 
Objectinserted[0].antiboit: 
Object__proto__: Object

Please help! Thanks.

Tags
Grid
Asked by
yiming
Top achievements
Rank 1
Share this question
or