I have an existing .NET MVC app where I upgraded it to a Telerik MVC app, and I'm noticing my controls htmlattributes are being overridden it seems.
In my view I have controls like this:
@Html.EditorFor(model => model.CompanyName, new {htmlAttributes = new {@class = "form-control", required = "true"}})
which would previously render like:
<input name="CompanyName" class="form-control text-box single-line" id="CompanyName" required="true" type="text" value="" data-val="true" data-val-length-max="50" data-val-length="50 characters max">
Now with Telerik, they render like this:
<input name="CompanyName" class="k-textbox" id="CompanyName" data-val="true" data-val-length-max="50" data-val-length="50 characters max">
You can see I'm losing my form-control, etc classes, and the required attribute. What is overriding this and how should I handle this?
5 Answers, 1 is accepted
Thank you for reaching out to us.
I assume that with upgrading to Telerik MVC App, the "Add Editor Templates" option has been checked. Thus, the templates have included. Which are extended with Kendo Extensions for the base types.
You can check in the Shared views if there is an EditorTemplates folder. By deleting this folder the templates will be removed and the native templates will be rendered when using EditorFor method.
If, however, you are interested in examining and updating this templates, you can adjust them by opening the file corresponding to the base type to be edito. In the case here, I guess it is the String.cshtml file.
Let me know if I can be any further helpful on the case.
Regards,
Ianko
Telerik

The information about the EditorTemplates is included in this article:
You can modify the following project-wide settings:
...
-
Copy Editor Templates - Copy the predefined editor templates to ~/Views/Shared/EditorTemplates
Regards,
Ianko
Telerik

Hello Brent,
Thank you for the suggestion. We have forwarded your feedback to the development team.
Regards,Alex Gyoshev
Telerik