Model state not valid

前端 未结 2 1470
感情败类
感情败类 2021-01-08 01:24

So I have a view called index that lays out all of the threads in my database. Then inside that view I\'m loading all the comments on the threads. When I call on my form tha

2条回答
  •  误落风尘
    2021-01-08 02:00

    Use the code below to iterate through the errors. Then you can see what field and what object is failing on validation. And then you can go from there. Just looking at the IsValid property is not going to give enough information.

    var errors = ModelState.Values.SelectMany(v => v.Errors);
    

    And then loop through the errors.

提交回复
热议问题