我要显示下面的客户对象的视图。
I have a view to Display the below Customer Object.
public Class Customer { public long Id { get; set; } public string Name { get; set; } public Address AddressInfo { get; set; } } public class Address { public string Details { get; set; } public City CityInfo { get; set; } public Region RegionInfo { get; set; } }和具有控制向客户返回查看
And Having an Controller to return the Customer to View
public ActionResult GetCustomer(long Id) { return View("Customer",GetCustomer(Id)); }和最后的看法是,
[Customer.cshtml] @model Customer; Name: @Model.Name Address Details: @Html.Partial("Address",Model) [Address.cshtml] @model Customer; @Model.CityInfo.Name, @Model.RegionInfo.Name一切似乎罚款。但我得到样板冲突的声明System.Web.Mvc.WebViewPage.Model错误的@ Html.Partial(地址,模型)我曾在许多项目中做过同样的,并没有得到问题。
All seems fine. But I am getting "'Model' conflicts with the declaration 'System.Web.Mvc.WebViewPage.Model" error on @Html.Partial("Address",Model) I had done the same before in many projects and did not got the problem.
我没有进一步诉讼的线索。
I have no clue of further proceeding.
可能有人请帮我解决这个问题。
Could someone please help me to resolve this issue.
我已经看到对于这种错误的许多职位。但这些并没有与@ Html.Partial()。
I have seen many posts regarding this kind of error. But those were not with the @Html.Partial().
感谢和放大器;问候,
Saravanakumar R上。
Saravanakumar R.
推荐答案我已经解决了这个问题..感谢观众。
I have resolved the issue.. Thanks for the viewers.
问题是我认为我是用地方的型号=>模式即可。它应为模式=>模式
The problem was In my View I was using somewhere Model => Model. Its should be model => model.
更多推荐
“模式”的声明“System.Web.Mvc.WebViewPage&LT冲突;&的TModel GT;。型号
发布评论