Asp.net mvc 2 如何将模型和视图日期传递给PartialView?

Asp.net mvc 2 如何将模型和视图日期传递给PartialView?,asp.net-mvc-2,Asp.net Mvc 2,如何将模型和视图日期传递给PartialView 我的代码是,但显示错误: <%Html.RenderPartial("~/Views/Location/location.ascx", new MVCLocation.Models.LocationModel(), (IEnumerable<SelectListItem>)ViewData["unit"]); %> 您不需要显式地将ViewData项作为参数传递给局部视图。您可以在部分视图中访问ViewData项

如何将模型和视图日期传递给PartialView

我的代码是,但显示错误:

 <%Html.RenderPartial("~/Views/Location/location.ascx", new MVCLocation.Models.LocationModel(), (IEnumerable<SelectListItem>)ViewData["unit"]); %>

您不需要显式地将
ViewData
项作为参数传递给局部视图。您可以在部分视图中访问
ViewData