“模式”的声明“System.Web.Mvc.WebViewPage&LT冲突;&的TModel GT;。型号

编程入门 行业动态 更新时间:2024-10-26 00:19:12
本文介绍了“模式”的声明“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;。型号

本文发布于:2023-11-10 00:37:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573880.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:冲突   型号   声明   模式   System

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!