I had a rough time following along using C#.NET 2008. I finally got it to work.
~/Views/Home/Index.aspx :
=========================
<%@ Import Namespace="MvcSample.Models"%>
...
<%
foreach (Movie m in (IEnumerable) ViewData.Model) {
Html.RenderPartial("~/Views/Home/MovieTemplate.ascx", m);
}
%>
NOTE: "RenderUserControl()" does not exist. I'm guessing it was replaced with "Html.RenderPartial()" which is what I used above.
~/Views/Home/MovieTemplate.ascx:
================================
<%@ Import Namespace="MvcSample.Models"%>
<tr>
<td><%= (ViewData.Model as Movie).Id %></td>
<td><%= Server.HtmlEncode((ViewData.Model as Movie).Title)%></td>
<td><%= (ViewData.Model as Movie).DateReleased.ToShortDateString()%></td>
</tr>
NOTE: There is no code behind file for this control. None was ever created. I can't see any way to strongly type the current record except to use "(ViewData.Model as Movie)" as I did in my code above. Is there a better way to do this?