My SomeModel is defined as:
public class SomeModel
{
public string property1 { get; set }
public bool property2 { get; set; }
}
I have an action:
public ActionResult Edit(int id)
{
SomeModel model = new SomeModel();
//... populate model ...
return View(model);
}
Assume that in the view property1 and property2 are instanced as @Html.EditorFor, in which case property1 would be rendered as a <input type='text'> and property2 would be a <input type='checkbox'>.
If I have the following controller action to handle a submit from the Edit form:
[HttpPost]
public ActionResult Edit(int id, SomeModel model, FormCollection collection)
{
}
How does the parameter model get populated, if ever?
If you use something like
All the model binding will be taken care of for you if you use the standard Html.EditorFor syntax in your view, as you have alluded to.
More on Model Binding here