编译器错误信息:CS0135:'模型'冲突的声明“System.Web.Mvc.WebViewPage&LT;&的TModel GT;。型号” [英] Compiler Error Message: CS0135: 'Model' conflicts with the declaration 'System.Web.Mvc.WebViewPage<TModel>.Model'
本文介绍了编译器错误信息:CS0135:'模型'冲突的声明“System.Web.Mvc.WebViewPage&LT;&的TModel GT;。型号”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用ASP.NET MVC 3,我创建了具有形式的强类型视图。在页面的底部,我已经和ActionLink的
I am using ASP.NET MVC 3. I have created a strongly typed view that has a form. At the bottom of the page I have and ActionLink
@Html.ActionLink("Edit", "Edit", new { id = Model.UserId})
,这将允许用户编辑的信息。当我运行应用程序我碰到下面的错误。
this will allow the user to edit the information. When I run the app I get the following error.
Compiler Error Message: CS0135: 'Model' conflicts with the declaration
'System.Web.Mvc.WebViewPage<TModel>.Model'
那会是什么。
推荐答案
我猜什么地方在你看来,你已经使用了拉姆达前pression使用保留强类型的辅助模式
关键字。就像例如:
I guess somewhere in your view you have used a strongly typed helper with a lambda expression using the reserved Model
keyword. Like for example:
@Html.TextBoxFor(Model => Model.SomeProperty)
应该是:
@Html.TextBoxFor(x => x.SomeProperty)
或任何其他名称。
这篇关于编译器错误信息:CS0135:'模型'冲突的声明“System.Web.Mvc.WebViewPage&LT;&的TModel GT;。型号”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文