Proximo
Proximo

Reputation: 6531

MVC Helper @Html.LabelFor not showing up?

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>

Upvotes: 0

Views: 2220

Answers (1)

Proximo
Proximo

Reputation: 6531

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

Upvotes: 1

Related Questions