2

I am developing a web application, where i want to give freedom of changing style elements of css linked to a page via an admin screen. So I am wondering is there any way I can load CSS file into a C# object or into XML passable formate and update it from the admin screen inputs? Thank you, Krishnaraj

  • It sounds like you are looking for a CSS parser: http://stackoverflow.com/questions/512720/is-there-a-css-parser-for-c – Jørn Schou-Rode Feb 18 '10 at 14:16
  • @C.Ross I am on MVC @jorn-schou-rode All the posts given in the above link talk about parsing the CSS. But I am for looking something like HTML Agility Pack(HTML parser that builds a read/write DOM and supports plain XPATH or XSLT), on which I can apply xpath to manipulate its content. – Krishnaraj Barvathaya Feb 18 '10 at 14:36

3 Answers3

1

I found this interesting article about parsing CSS in CodeProject. I need to check how I can customize it to suite my requirement.

0

You can create several themes and change them in the admin section. Also you can create different skins for your controls.

Links: ASP.NET Themes and Skins Overview, How to: Apply ASP.NET Themes

sashaeve
  • 9,387
  • 10
  • 48
  • 61
0

If you are using ASP.NET MVC, you can create new ActionResult type called CssResult that dynamically generates a CSS. An example of how to write a custom ActionResult can be found here.

C. Ross
  • 31,137
  • 42
  • 147
  • 238
  • I went though the link, but I am not sure whether I will be able to load css file into an c# object and fire XPATH over it. I must give freedom to user to choose style elements such as height, color, font, font style etc. I will provide a default style elements which user can customize himself. So I will be having a default css file, elements of which I want to populate over the web form and user can change the element values. When he clicks on Finish/Save, I want to save these new values in to the same CSS file. Any idea how can I achieve this?? – Krishnaraj Barvathaya Feb 18 '10 at 14:52