“模式”的声明“System.Web.Mvc.WebViewPage&LT冲突;&的TModel GT;。型号 [英] 'Model' conflicts with the declaration 'System.Web.Mvc.WebViewPage<TModel>.Model

查看:104
本文介绍了“模式”的声明“System.Web.Mvc.WebViewPage&LT冲突;&的TModel GT;。型号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示下面的客户对象的视图。

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;。型号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆