0

I added a kendo UI MVC library, I had to update my MVC to the latest version (5.3.6) in order to make it all function...

but now when I run my application, the Html.editorFor contains only a single class k-textbox (which are kendo UI classes) even though I am adding the class form-control to it.

This editorFor

@Html.EditorFor(model => model.leverancier.leveranciernaam, new { htmlAttributes = new { @class = "form-control disabled" } })

creates this Html:

<input class="k-textbox" data-val="true" data-val-length="Het veld naam moet een tekenreeks met een maximumlengte van 255 zijn." data-val-length-max="255" id="leverancier_leveranciernaam" name="leverancier.leveranciernaam" value="Bauerfeind">

so where's my form-control class?

EDIT

the application used to be an Asp.Net mvc 5 app. but in order for kendo to work I had to convert it to a Telerik Application.

2
  • Kendo adds some templates to \Shared\EditorTemplates for string, datetime, etc. I wonder if @Html.Kendo.TextBoxFor is overriding your class? Try Html.TextBoxFor instead of EditorFor. Oct 9, 2018 at 19:37
  • Hi @SteveGreene, I thought so too. so I excluded them from my project but still it happens. I've also tried commenting out the scripts and styles but still all my textboxes contain none of the classes I told them to have. yet they just contain "k-textbox"
    – FllnAngl
    Oct 10, 2018 at 6:41

1 Answer 1

1

This is an old question but I wanted to confirm @SteveGreene's suggestion that templates could be the culprit here. @FllnAngl tried excluding the EditorTemplates from the project. Thank you both for putting me on the right path.

I had the same issue and not only removed the Views\Shared\EditorTemplates folder from my MVC project but also deleted the *.cshtml files in that folder. This solved my problem completely.

The Telerik UI for MVC, using the Editor Templates, was silently replacing the @Html.EditorFor with @Html.Kendo().TextBoxFor and therefore in my views was replacing the css class form-control with k-textbox, which affected input width.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.