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

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>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)