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

[Solved] Can I use 2 themes on the same page?

1 Answer 27 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
benoit
Top achievements
Rank 1
benoit asked on 13 Sep 2010, 07:53 PM
Hello, I"m using the Telerik menu and the datePicker in the same page.

I would like to use the forest theme for the menu and the windows7 theme for the date picker. But there is only one theme selected per page. Maybe I'm misusing the theme method, but I didn't found any example on how to use it. I tried with a simpler project, and two datepicker, and I'm having the same problem.

Here is my code.

In site.master, declaration of my themes
<%= Html.Telerik().StyleSheetRegistrar().DefaultGroup(Function(group) group.Add("telerik.common.min.css").Add("telerik.windows7.min.css").Add("telerik.forest.min.css"))%>


In site.master, registration of scripts:
<%= Html.Telerik().ScriptRegistrar()%>

in aspx page:
<%: Html.Telerik().DatePicker().Name("DateNaissance").Theme("windows7")%>
<%: Html.Telerik().DatePicker().Name("DateNaissance2").Theme("forest")%>
        

Do you have any tips for me, or if it's a known problem?
Thank you

1 Answer, 1 is accepted

Sort by
0
benoit
Top achievements
Rank 1
answered on 17 Sep 2010, 07:16 PM
I will answer myself...I found it.

It seems there is no way to do it. The valid workaround is to modify the css of one of the two themes you want to use.

You add with StyleSheetRegistrar the 2 themes you want to use adding lastly the main theme you want to use. Then, you modify the first one added by prefixing each element of the css with a css class. Example:

.t-widget
{
    border-color: #486b23;
    background-color: #d1deb6;
}
  
BECOMES
.forest .t-widget
{
    border-color: #486b23;
    background-color: #d1deb6;
}

Then, for the element of the page where you want to use the 2nd theme, you englobe it in a div which has class="forest".

That's it. Simple, but boring job to do at each new release of telerik.




Tags
Date/Time Pickers
Asked by
benoit
Top achievements
Rank 1
Answers by
benoit
Top achievements
Rank 1
Share this question
or