"No overload for LabelFor method accepts 2 arguments" in MVC3

I am running ASP.NET MVC 3 and I am viewing the Edit view for my model. I have a property FullNamethat I want to display as "Full name".

Here is the line (s) of the violation:

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

Now intellisense shows that there is overload - there are two signatures, the first of which accepts only the expression, and the second accepts both the expression and the string to be displayed. However, when I browse the page, I get the entitled exception ("no overload ...").

Does anyone succeed using this overload and any tips on what I might lose?


Update: I tried reinstalling MVC3 to no avail. However, I 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.

IIS MVC 2, MVC 3? ?

+5
5

-, MVC 2 .

, DLL , 2.0.0.0 -, ...?

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

MVC3:

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

, [DisplayName]:

[DisplayName("Full name")]
public string FullName { get; set; }

:

<%: Html.LabelFor(model => model.FullName) %>
+4

, MVC 3.0 . , .

Visual Studio Solution Explorer, [Project], "", "System.Web.Mvc" "" . 3.x.

, web.config machine.config , MVC 2.x .

Web.config MVC ( System.Web.Mvc, Version = 2.0.0.0 System.Web.Mvc, Version = 3.0.0.0).

2 3 web.config:

...
<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
      <bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0"/>
    </dependentAssembly>
  </assemblyBinding>
</runtime>
...
+2

.

 <%: Html.LabelFor(model => model.FullName) %>

public class ModelClass{

..
..

[DisplayName("Full Name")]
public string FullName{
+1

MVC 3.0 LabelFor<TModel, TValue>(HtmlHelper<TModel>, Expression<Func<TModel, TValue>>, String).


http://msdn.microsoft.com/en-us/library/system.web.mvc.html.labelextensions(v=vs.98).aspx

http://msdn.microsoft.com/en-us/library/system.web.mvc.html.labelextensions.aspx (MVC 2.0).

, ('no ... ').

, MVC 3.0 IIS.

0

All Articles