Assigning CSS stylesheets to sites

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows how you can assign a an existing CSS stylesheet to a site:

 

[C#]

 

using CMS.SiteProvider;

 

...

 

       // Get stylesheet and site object

      CssStylesheetInfo csi = CssStylesheetInfoProvider.GetCssStylesheetInfo("TestStylesheet");

      SiteInfo si = SiteInfoProvider.GetSiteInfo("CorporateSiteASPX");

 

      // If both exist

      if ((csi != null) && (si != null))

       {

          // Add stylesheet to site

          CssStylesheetSiteInfoProvider.AddCssStylesheetToSite(csi.StylesheetID, si.SiteID);

 

       }

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_assigning_css_stylesheets_to_sites.htm