私のコントローラコードは次のようになります:
[HttpPost]
public ActionResult Create(ExampleViewModel model)
{
model.User.RegistrationNumber = this.RegistrationNumber;
if (ModelState.IsValid)
{
}
return View("Create", model);
}
"Registration Number cannot be blank"
まだ明示的に設定していることを示す検証エラーメッセージが表示され続けます。
ModelState
モデルを何らかの方法で変更したため、リセットする必要がありますか?
基本的にテキストボックスを無効に設定すると、フォームの投稿中にデータが失われたため、明示的に再度設定する必要があります。