Search code examples
c#asp.net.netcssenterprise-web-library

How to add a custom style sheet to a web application utilizing EWL?


I'm trying to use Enterprise Web Library to quickly bring up a a web app and I want to add a custom style sheet. I'm not sure how I can reference the style sheet within the application.


Solution

  • Assume your style sheet is located in the web app project at Styles/MyStyles.css. In your Global.asax class, override EwfApp.GetStyleSheets like so:

    protected override List<CssInfo> GetStyleSheets() {
      return new List<CssInfo> { new Styles.MyStyles.Info() };
    }
    

    This code won't compile unless you've run UpdateDependentLogic after creating your CSS file. This is how the Info class gets created for your style sheet.