March 2011 Blog Posts

Dynamic CSS with ASP.NET MVC and ContentResult

The ContentResult class is of type ActionResult, which means it is used to return text content from Controller Actions. There are multiple uses for the ContentResult, and one use is to create CSS dynamically. One would simply point a style sheet to an action and the action would return the dynamically generated CSS. In my case I am developing a Web app where each client can have their own theme, which is set in the database. I tackled this requirement with the following code: 1: public ActionResult CssStyle() ...

posted @ Tuesday, March 01, 2011 12:33 PM | Feedback (1)