0

Am I missing a reference or something?

I have a reference to System.Web.Mvc 4.0x

But whenever I try this

 @Html.LabelFor(x=>Model.yadda, new {id="_lblYadda"});

I get nothing I can't even get it to compile. I only have a reference to

 @Html.Label("Yadda", "Yadda yadda");

I spent like 5 minutes looking, I know it's simple so.. help please!

WebConfig namespaces are:

 <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Optimization" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Web.WebPages" />
  </namespaces>
Proximo
  • 6,235
  • 11
  • 49
  • 67
  • Do you include the namespace `System.Web.Mvc.Html` in your web.config? – Jasen May 10 '15 at 00:36
  • 1
    Please include more information about the compilation error – Lukas Kubis May 10 '15 at 00:53
  • Did you upgrade/convert a project? I have never had to mess with this besides adding my own namespaces. Maybe try restarting VS? – Jasen May 10 '15 at 00:53
  • Error is the common: Reference to LabelFor not found... I noticed that if I write this @System.Web.Mvc.Html.LabelExtensions.LabelFor() I can get to the extension definition. – Proximo May 10 '15 at 01:13

1 Answers1

1

Found my issue:

I noticed that the project that works references System.Web.Mvc.Html and the one that I'm using for @Html.Label() references System.Web.WebPages.dll

I removed the reference to System.Web.WebPages.dll and now it works with all the extensions.

System.Web.WebPages.dll is crap... The End... THanks

Proximo
  • 6,235
  • 11
  • 49
  • 67