1

I am using the label helper in a web app:

@Html.Label("MyLabel", "MyLabelForAttribute")

according to the intellisense im using this function:

Public Function Label(labelText As String, labelFor As String) As System.Web.IHtmlString

Member of System.Web.WebPages.Html.HtmlHelper

So the first value is the label's text and the second is the label's for attribute, so it should render this html:

<label for="MyLabelForAttribute">MyLabel</label>

However it is rending this html:

<label for="MyLabel">MyLabelForAttribute</label>

It is inverting the values.

I suspect the problem is that the web app (somehow) is using this function:

Public Shared Function Label(html As System.Web.Mvc.HtmlHelper, expression As String, labelText As String) As System.Web.Mvc.MvcHtmlString

Member of System.Web.Mvc.Html.LabelExtensions

Is there a way to force the app to use this assembly System.Web.WebPages.Html.HtmlHelper?

It is actually using the wrong assembly, is there a way to force the app to use System.Web.WebPages.Html.HtmlHelper or fix the intellisense to show the used assembly (System.Web.Mvc.Html.LabelExtensions) ?

enter image description here

enter image description here

jvc
  • 21
  • 3
  • What version of Visual Studio are you using? Do you have the latest updates? My VS2010 - VS2015 intellisense shows I am using the `` method. – Jasen Apr 29 '16 at 18:31
  • Take a look at this question: http://stackoverflow.com/questions/3239006/how-do-i-import-a-namespace-in-razor-view-page It will tell you how set up using for Razor in your page/web.config. – brian chandley Apr 29 '16 at 18:57
  • @Jasen I'm using VS2015 (Professional) , the issue happens in VS2013(Ultimate) too. In a brand new project intellisense shows the method. – jvc Apr 29 '16 at 19:52
  • Then it sounds like your project has messed up the view page namespaces somehow. – Jasen Apr 29 '16 at 22:21

0 Answers0