why my ModelState in controller aren't updated or show true even though there is an error. here is my code
$('#extracontent').on('click', '#Save', function () {
$.ajax({
type: frm.attr('method'),
url: frm.attr('action'),
data: $('#form').serializeArray(),
success: ...,
error: ...
}
});
//}
});
[Authorize]
[HttpPost]
public ActionResult Edit(EditUserModel savedUserModel)
{
if (!ModelState.IsValid) // model.isValid is true even when there is an error in model
return PartialView....
I have already try to use TryUpdateModel(savedUserModel) UpdateModel(savedUserModel)
but model state is still valid... the validation do work I already tested using simple POST back