This is a migrated thread and some comments may be shown as answers.

Use Kendo styling only on some pages

3 Answers 90 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 24 Mar 2020, 03:54 PM

I have a large existing ASP.NET MVC project where I want to introduce Telerik gradually. I have separate layout files for pages that should use Telerik and pages that do not. Some fields that do not use the Telerik included layout page are still getting the kendo styling.

Example:

I have a login page. Password field should use bootstrap styling.

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

 

Field settings from view model:

[DisplayName("Password")]
[DataType(DataType.Password)]
public string Password { get; set; }

 

When I load the page the field gets kendo styling. How do I prevent this?

<input class="k-textbox" id="Password" name="Password" type="password" value="" />

3 Answers, 1 is accepted

Sort by
1
Accepted
Aleksandar
Telerik team
answered on 26 Mar 2020, 02:33 PM

Hi Mike,

To style input elements Kendo uses templates located \Shared\EditorTemplates. In the current example the Password.cshtml is defined as follows:

@Html.TextBoxFor(model => model, new {@class="k-textbox", type="password" })

You could update the Password Editor template and instead of the k-textbox add the class required.

I hope this helps. Let me know if you have additional questions.

Regards,
Aleksandar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Mike
Top achievements
Rank 1
answered on 26 Mar 2020, 05:42 PM
That worked. Will this change "stick" after a version upgrade, or do I need to remember to make the change after an upgrade?
1
Aleksandar
Telerik team
answered on 30 Mar 2020, 11:04 AM

Hi Mike,

It would depend on how you upgrade the project - if you use the VS extension and run the Upgrade Wizard  Editor templates might get overwritten. Following the steps of the Upgrade Wizard, you will be prompted to confirm whether or not you would like to update the Editor Templates as well. 

Regards,
Aleksandar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Editor
Asked by
Mike
Top achievements
Rank 1
Answers by
Aleksandar
Telerik team
Mike
Top achievements
Rank 1
Share this question
or