The following sample code shows how you can modify the Display name of an existing CSS stylesheet:
[C#]
using CMS.SiteProvider;
...
// Get stylesheet object CssStylesheetInfo csi = CssStylesheetInfoProvider.GetCssStylesheetInfo("TestStylesheet");
// If stylesheet exists if (csi != null) { // Update property csi.StylesheetDisplayName += " updated";
// Save to database CssStylesheetInfoProvider.SetCssStylesheetInfo(csi); } |
The following sample code shows how you can create a new CSS stylesheet and add it to the system:
[C#]
using CMS.SiteProvider;
...
// Create new object CssStylesheetInfo csi = new CssStylesheetInfo();
// Set properties csi.StylesheetDisplayName = "Test stylesheet"; csi.StylesheetName = "TestStylesheet"; csi.StylesheetText = "Some CSS code";
// Save to database CssStylesheetInfoProvider.SetCssStylesheetInfo(csi); |
The following sample code shows how you can delete an existing CSS stylesheet:
[C#]
using CMS.SiteProvider;
...
// Get stylesheet object CssStylesheetInfo csi = CssStylesheetInfoProvider.GetCssStylesheetInfo("TestStylesheet");
// If stylesheet exists if (csi != null) { // Delete from database CssStylesheetInfoProvider.DeleteCssStylesheetInfo(csi); } |
Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_managing_css_stylesheets.htm