The following example assigns a CSS stylesheet to a site.
privatebool AddCssStylesheetToSite() { // Get the css stylesheet CssStylesheetInfo stylesheet = CssStylesheetInfoProvider.GetCssStylesheetInfo("MyNewStylesheet"); if (stylesheet != null) { int stylesheetId = stylesheet.StylesheetID; int siteId = CMSContext.CurrentSiteID;
// Save the binding CssStylesheetSiteInfoProvider.AddCssStylesheetToSite(stylesheetId, siteId);
returntrue; }
returnfalse; }
The following example removes a stylesheet from a site.
privatebool RemoveCssStylesheetFromSite() { // Get the css stylesheet CssStylesheetInfo removeStylesheet = CssStylesheetInfoProvider.GetCssStylesheetInfo("MyNewStylesheet"); if (removeStylesheet != null) { int siteId = CMSContext.CurrentSiteID;
// Get the binding CssStylesheetSiteInfo stylesheetSite = CssStylesheetSiteInfoProvider.GetCssStylesheetSiteInfo(removeStylesheet.StylesheetID, siteId);
// Delete the binding CssStylesheetSiteInfoProvider.DeleteCssStylesheetSiteInfo(stylesheetSite);