user2513527
user2513527

Reputation: 39

Kendo Grid color change dynamically

How to change the Kendo Grid Theme change dynamically based on user selected dropdown list. Example default, silver, metro, Office Blue theme etc., If the change the theme from default to Metro grid color re-appearance automatically. Any one can help me please. I am new of this concepts.

Upvotes: 0

Views: 2078

Answers (1)

Tavousi
Tavousi

Reputation: 15446

You can when you are defining link tag, add an id to it:

<link id="kendoStyle" href="~/Content/KendoUI/kendo.silver.min.css" rel="stylesheet" />.

And then set values of your drop down to "~/Content/KendoUI/kendo.silver.min.css" and "~/Content/KendoUI/kendo.moonlight.min.css" and ...

Then when user select an item in drop down, get element by id "kendoStyle" and set href to value of drop down.

Like this:

Define main theme:

<link id="kendoStyle" href="~/Content/KendoUI/kendo.silver.min.css" rel="stylesheet" />

Define dropdown:

<select id="style"><option value="">---</option>
<option value="~/Content/KendoUI/kendo.silver.min.css">silver</option>
<option value="~/Content/KendoUI/kendo.moonlight.min.css">moonlight</option>
</select>

Change theme dinamically:

$('#kendoStyle').attr('href',$('#style').val())

Upvotes: 2

Related Questions