バリデーション - ModelStateを直接操作するエラーをクリアする [HttpPost]
public ActionResult foo(MyViewModel vm){
if (vm.age > 100) {
vm.age = 100
ModelState["age"].Errors.Clear();
}
}
参考http://stackoverflow.com/questions/2883630/asp-net-mvc-modelstate-isvalid-returning-false 参考http://stackoverflow.com/questions/7424003/mvc3-remove-modelstate-errors |
|