asp mvc partial with model and ViewDataDictionary - how do I access the ViewDataDictionary?

Solution 1:

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>