Problem using Labelfor Razor MVC 3 + C#

Asked

Viewed 97 times

1

I have the following error in mine View: as I pass @class="classe boot-strap" is not used, whether or not View within the parameter @class he insists on using the 'text-box single-line', Just below I’ll leave the code snippets.

Code Razor:

 @Html.EditorFor(model => model.DataManutencao, new { @class = "span2 control-label" })

Chrome debugger HTML code:

<input class="text-box single-line" data-val="true" data-val-date="The field Data Agendamento must be a date." data-val-required="Este campo é obrigatório!" id="DataManutencao" name="DataManutencao" type="datetime" value="01/01/0001">
  • Try to change the EditorFor for TextBoxFor. In MVC 3, EditorFor does not work well with HTML attributes.

  • I used to use the textBoxFor, it works, but I can not use the model data Annotations, have to solve this problem or just passing the HTML attributes through the tags same?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.