I am creating a form which updates two related models, for this example a Project with a collection of Tasks, I want the controller to accept a single Project which has its
Guess I posted too soon. This thread had the answer I was looking for
asp.net MVC RC1 RenderPartial ViewDataDictionary
I ended up using this terse syntax
@Html.Partial("_TaskForm", Model.Tasks[i], new ViewDataDictionary { {"counter", i} } )
Then in partial view
@model MyWebApp.Models.Task
@{
int index = Convert.ToInt32(ViewData["counter"]);
}
<div>
@Html.TextBox(String.Format("Tasks[{0}].Name", index), Model.Name)
</div>
<div>
@Html.TextBox(String.Format("Tasks[{0}].DueDate", index), Model.DueDate)
</div>