我有一个创建一个列表,并返回给我看的动作..MVC3剃须刀 - 模型和视图
public ActionResult GetCustomers()
{
return PartialView("~/Views/Shared/DisplayTemplates/Customers.cshtml", UserQueries.GetCustomers(SiteInfo.Current.Id));
}
并在“〜/查看/共享/ DisplayTemplates/Customers.cshtml”的观点我有以下几种:
@model IEnumerable<FishEye.Models.CustomerModel>
@Html.DisplayForModel("Customer")
然后,我有在 “〜/查看/共享/ DisplayTemplates/Customer.cshtml” 视图:
@model FishEye.Models.CustomerModel
@Model.Profile.FirstName
我正在吨他错误:
The model item passed into the dictionary is of type System.Collections.Generic.List`1[Models.CustomerModel]', but this dictionary requires a model item of type 'Models.CustomerModel'.
难道不应该显示Customer.cshtml在Customers.cshtml集合中的每一个项目?
帮助!
完美,谢谢这工作的魅力! –
@JamesWoodley:不客气。很高兴我能帮上忙。 – Shyju