The responsibility of the dispatcher is to prepare the presentation model that will be passed to the presentation. Therefore, if you need, for example, to initialize the view model using 5 empty contact lines, you can do this simply in your controller:
public ActionResult Index() { var model = new MyViewModel {
and, in your opinion, use the EditorFor helper, as usual:
@model MyViewModel ... @Html.EditorFor(x => x.Contacts)
This will create an appropriate editor template for each of the 5 elements that we have added to the Contacts collection.
Darin Dimitrov
source share