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

RadStyleSheetManager and embedded skins

1 Answer 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dasha
Top achievements
Rank 1
Dasha asked on 27 Mar 2012, 01:21 PM
Hello,

We're developing web parts in SharePoint using RadControls.  We're allowing our customers to select which skin they'd like to apply from the list of available embedded skins, and just recently we encountered a problem with IE and it's 31-stylesheet limit.  If we have more than 2 or 3 components on the page, the styling is not properly applied.  So we're tyring to make use of the RadStyleSheetManager to combine the skin styles to reduce the number of files on the page.

This is what I have so far, in PageLoad, the following code is called:

CWGrid.Skin = skinName;
CWGrid.EnableEmbeddedBaseStylesheet = false;
CWGrid.EnableEmbeddedSkins = false;
RadAjaxLoadingPanel1.Skin = skinName;
RadAjaxLoadingPanel1.EnableEmbeddedBaseStylesheet = false;
RadAjaxLoadingPanel1.EnableEmbeddedSkins = false;
//context menu
cm.Skin = skinName;
cm.EnableEmbeddedBaseStylesheet = false;
cm.EnableEmbeddedSkins = false;
gcm.Skin = skinName;
gcm.EnableEmbeddedBaseStylesheet = false;
gcm.EnableEmbeddedSkins = false;
//radWindow
cwPrintWindow.Skin = skinName;
cwPrintWindow.EnableEmbeddedBaseStylesheet = false;
cwPrintWindow.EnableEmbeddedSkins = false;
 
string telerikAssembly = typeof(RadGrid).Assembly.FullName;
//string telerikAssembly = "";
string telerikSkinsAssembly = typeof(Telerik.Web.UI.Skins.RadGrid).Assembly.FullName;
//string telerikSkinsAssembly = "";
string[] components = { "ToolBar", "Input", "Grid", "Menu", "ComboBox", "Calendar", "Menu", "Window" };
if (RadStyleSheetManager.GetCurrent(wp.Page) != null) cssManager = RadStyleSheetManager.GetCurrent(wp.Page);
 
for (int i = 0; i < components.Length; i++)
{
    cssManager.StyleSheets.Add(new StyleSheetReference("Telerik.Web.UI.Skins." + skinName + "." + components[i] + "." + skinName + ".css", telerikSkinsAssembly));
    cssManager.StyleSheets.Add(new StyleSheetReference("Telerik.Web.UI.Skins.Default." + components[i] + ".Default.css", telerikAssembly));
    cssManager.StyleSheets.Add(new StyleSheetReference("Telerik.Web.UI.Skins." + components[i] + ".css", telerikAssembly));
}


But for some reason the combined css file is rendered empty, and nothing is styled.  What am I missing?

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 30 Mar 2012, 09:40 AM
Hi Dasha,

Why have you disabled embedded resources if you use built-in skins? If you enable the embedded skins and base stylesheets of the controls, the stylesheetmanager will combine the rendered stylesheets without the need of registering them explicitly.  

Greetings,
Tsvetina
the Telerik team
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Dasha
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or