[否过载方法'LabelFor“需要两个参数"在MVC3 [英] "No overload for method 'LabelFor' takes 2 arguments" in MVC3

查看:161
本文介绍了[否过载方法'LabelFor“需要两个参数"在MVC3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行ASP.NET MVC 3,我期待在我的模型编辑视图。我已经得到了我想要呈现为全名A 全名属性。

I'm running ASP.NET MVC 3 and I'm looking at a Edit view for my model. I've got a FullName property which I want to render as "Full name".

下面是违规线(S):

<div class="display-label">
    <%: Html.LabelFor(model => model.FullName, "Full name") %>
</div>

现在的智能感知的显示的是,超载的存在 - 有两个签名,先取只防爆pression第二同时服用防爆pression和字符串是显示。然而,当我浏览的网页,我得到了标题的异常(无过载...')

Now the intellisense shows that the overload exists - there are two signatures, the first taking just the Expression and the second taking both the Expression and the string to be displayed. However when I browse to the page I get the titled exception ('no overload...').

任何人有使用此重载什么我可能会丢失任何的成功,有什么建​​议?

Anyone have any success using this overload, and any advice on what I might be missing?

更新:我已经尝试重新安装MVC3无济于事。不过,我已经在错误页面上的编译器输出注意到了这一点:

Update: I've tried reinstalling MVC3 to no avail. However I have noticed this in the compiler output on the error page:

c:\Windows\assembly\GAC_MSIL\System.Web.Mvc\2.0.0.0__31bf3856ad364e35\
    System.Web.Mvc.dll: (Location of symbol related to previous error)

这表明,我认为我使用MVC 2,不MVC 3。

Which indicates to me that I'm using MVC 2, not MVC 3.

我有什么配置错误,或者为什么我的IIS使用MVC 2,而不是MVC 3?我该如何解决这个问题?

What have I misconfigured, or why would my IIS be using MVC 2 rather than MVC 3? How can I fix this?

推荐答案

您应该检查你的web配置,如果这是在一个点一个MVC 2的项目。

You should check your web config if this was an MVC 2 project at one point.

您可能会被引用的项目引用的DLL的正确版本,但在web配置中拉2.0.0.0运行时...?

You might be referencing the correct version of the DLL in the project References but pulling in 2.0.0.0 in the web config when it runs...?

http://blog.devlpr.net/2010/07/27/upgrading-an-asp-net-mvc-2-project-to-asp-net-mvc-3/

在我MVC3应用程序:

In my MVC3 app:

<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

这篇关于[否过载方法'LabelFor“需要两个参数&QUOT;在MVC3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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