【发布时间】:2011-07-11 01:02:33
【问题描述】:
这是我的目标
public class ProductContent
{
public Product Product { get; set; }
public Location ProductLocation { get; set; }
}
我有一个与 Location 对象紧密耦合的视图。
我有一个与 ProductContent 紧密耦合的视图 在我的产品内容视图中,我这样做了
@Html.Partial("../PartialViews/Location", Model.ProductLocation)
我收到一个错误提示
The model item passed into the dictionary is of type 'ProductContent', but this dictionary requires a model item of type 'Location'.
我正在传递类型为 location 的 Model.ProductLocation 但为什么它仍然出错?
我正在使用 MVC3 C# Razor
【问题讨论】:
-
视图中的@model 指令是什么?
-
@model ProjectName.Models.DAO.Location
-
我猜
Model.ProductLocation为空 -
@driushkin:错误消息听起来不像是空错误。
-
@Natasha Thapa:请显示视图的模型声明。
标签: c# asp.net-mvc asp.net-mvc-3 razor tightly-coupled-code