MySomeModelは次のように定義されます。
public class SomeModel
{
public string property1 { get; set }
public bool property2 { get; set; }
}
アクションがあります:
public ActionResult Edit(int id)
{
SomeModel model = new SomeModel();
//... populate model ...
return View(model);
}
property1ビューで とproperty2が としてインスタンス化されていると仮定します@Html.EditorFor。この場合、property1は としてレンダリングされ、<input type='text'>とproperty2なります<input type='checkbox'>。
編集フォームからの送信を処理する次のコントローラー アクションがあるとします。
[HttpPost]
public ActionResult Edit(int id, SomeModel model, FormCollection collection)
{
}
パラメータ モデルはどのように設定されますか?