Widget CSS

Topics: Customizing Orchard, Troubleshooting, Writing modules
Jul 16, 2011 at 4:14 PM

I cannot for the life of me figure out how to register a CSS stylesheet for my widget. The docs mention Html.RegisterStyleSheet (and also RegisterStylsheet) but these do not exist.

How do you add a stylesheet for your widget, so that the Orchard CMS can make sure there are no duplicates, register the sheet, etc?


Jul 17, 2011 at 9:12 AM
Edited Jul 17, 2011 at 9:14 AM

To add a reference to a stylesheet, near the top of your view add:




You need to make sure that MyStyle.css is in your theme or module's Styles directory. Orchard takes care of making sure that duplicate references are reduced to just one.

If you want to register the stylesheet as a resource that other modules or themes can use, take a look at Orchard.jQuery.ResourceManifest, which registers a number of scripts and styles for global use.

Jul 21, 2011 at 2:28 AM

Thank you very much.