Custom Telerik Skin assembly is not loading its styles

665 views Asked by At

I followed these instructions: http://docs.telerik.com/devtools/aspnet-ajax/general-information/controlling-visual-appearance/how-to-load-skins-from-external-assemblies

Button.Test.css

.RadButton_Test {
  background-color: red !important;
}

Button.css

<< empty file >>

RadButton.cs

[assembly: System.Web.UI.WebResource("Skins.Button.css", "text/css", PerformSubstitution = true)]
[assembly: System.Web.UI.WebResource("Skins.Test.Button.css", "text/css", PerformSubstitution = true)]
namespace Skins
{

  [Telerik.Web.EmbeddedSkin("Button", null, typeof(RadButton))] 
  [Telerik.Web.EmbeddedSkin("Button", "Test", typeof(RadButton))] 
  public class RadButton
  {
  }
}

web.config

<add key="Telerik.Web.SkinsAssembly" value="Skins"/>

page.aspx

<telerik:RadButton ID="btn" ButtonType="LinkButton" runat="server" Skin="Test" Text="GO" OnClick="btnClick"></telerik:RadButton>        

.

.

The buttons are not red. The page renders fine but without the styles. When I change the skin="Test" to skin="TestXX" I get the error that there is no embedded skin TestXX, so they seem to be loaded properly. The button renders to have the class RadButton_Test.

What do I miss?

1

There are 1 answers

1
rdmptn On

First, try the AssemblyBuilder: http://skinsassemblybuilder.telerik.com/ in case the issue is with the generation of the assembly.

If this does not help, try the sample project form this thread: http://www.telerik.com/support/code-library/how-to-load-skins-from-external-assemblies. You can try renaming files and namespaces there after replacing them with your own files.

Generally, you should ensure all the webresources are fetched. If there are 404 errors, there are two probable causes:

  • the stylesheets/sprites are not marked as Embedded Resource (that's their Build Action)

  • paths and/or namespaces are incorrect. Here is some of the code that registers built-in skins so you can use it as reference: http://pastebin.com/BJJbgngB (the C# syntax used breaks SO's markdown)