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

Cannot override the skin of a single instance of a control once a custom skin has been set.

2 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 06 Feb 2014, 08:19 PM
In my App_Themes folder, I have a file called TelerikCustomSkin.skin.  In it, I set the default skins for the Telerik controls.  A sample of the contents is as follows:

...
<
telerik:RadScheduler runat="server" Skin="Office2007" EnableEmbeddedSkins="true" />
<telerik:RadToolBar runat="server" Skin="Custom" EnableEmbeddedSkins="false" height="23px"/>
<telerik:RadTreeView runat="server" Skin="Custom" EnableEmbeddedSkins="false" Font-Names="Arial" Font-Size="9pt" />
<telerik:RadDock  runat="server" Skin="Custom" EnableEmbeddedSkins="false" />
<telerik:RadTabStrip runat="server" Skin="Custom" EnableEmbeddedSkins="false" />
...


I am attempting to use the radTreeView on a page similar to your demo page showing examples for each of your controls.  So in my .aspx page I have the following:

<telerik:RadTreeView ID="rtvTree" runat="server" EnableEmbeddedSkins="True" Skin="Silk">
    <Nodes>
        <telerik:RadTreeNode runat="server" Text="Top Ten" Value="pnlTopTen"/>
        <telerik:RadTreeNode runat="server" Text="Topic Areas" Value="pnlTopicAreas"/>
    </Nodes>
</telerik:RadTreeView>

However, my radTreeView is still being rendered using my custom skin, not the embedded skin.  I have removed the custom skin from the TelerikCustomSkin.skin and it works then.  However, I would now have to change all the other locations radTreeView is being used and add the skin attribute.

I am using Telerik 3.5 from release 2013_3.1114.

Any help is appreciated.

2 Answers, 1 is accepted

Sort by
0
Magdalena
Telerik team
answered on 07 Feb 2014, 04:13 PM
Hi Ed,

This issue could occur when the RadTreeView with applied Silk skin is on the page with reference to your custom skin and at the same time the custom skin has some rules without .RadTreeView_Custom in front of selectors. In this case the rules used in your custom skin can overwrite the Silk skin. To avoid this issue, please add the class .RadTreeView_Custom in front of every selector used in your custom skin.

If the problem still occurs, I would like to ask you to provide a live URL or runnable project with reproduced issue so I can test it locally and be able to assist you in the most efficient way.

Regards,
Magdalena
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Ed
Top achievements
Rank 1
answered on 07 Feb 2014, 06:56 PM
I've been able to track down the issue to how themes are applied in asp.net.  In the web.config file, I have

<system.web>
    <pages theme="abc">
</system.web>

In the folder App_Themes/abc exists the skin file mentioned in my original post.  This trumps everything I try to override in the .aspx page.

I got around this by specifying the skin in the code behind for the page in the OnInit event.

rtvTree.EnableEmbeddedSkins = true;
rtvTree.Skin = "Silk";
Jack
Top achievements
Rank 1
commented on 27 Aug 2022, 05:59 PM | edited

I am facing similar issues. This I believe is a defect in the Telerik design. The .skin file should set the default properties for the controls, but if a .aspx/.ascx file places a control and sets a property differently than what the .skin specifies, it should take precedence and thus override what the .skin specified.

We should NOT have to reset the properties in the code-behind like this. The .skin file should NOT trump. The .ascx/.aspx should trump.

Jack
Top achievements
Rank 1
commented on 27 Aug 2022, 06:30 PM

Ah, nevermind. It is not a Telerik defect. It is how Themes (.skin files) are applied based on how they are configured in the web.config.

Use <pages styleSheetTheme="abc" ... /> instead of <pages theme="abc" ... /> and it will allow the .aspx/.ascx to override what is in the .skin.

Tags
General Discussions
Asked by
Ed
Top achievements
Rank 1
Answers by
Magdalena
Telerik team
Ed
Top achievements
Rank 1
Share this question
or