Click here to Skip to main content
15,868,292 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm trying to create a theme switcher using which user can change website themes by clicking buttons. i don't want to use either local storage or cookies. i'm trying to do it using xml. i can attach stylesheet to a xml file and run the html. but this forces style changes in xml file. html page doesn't change. how do i go about it. pls help.
(ASP.net framework)
Thanks in advance
Posted
Comments
Sergey Alexandrovich Kryukov 15-Apr-15 2:26am    
No need to use XML file. Why? The solution can be much simpler. (And what would it mean, "attach to XML file"?)
Moreover, it does not have to be related to ASP.NET. Of course, you can do it all on the server side through a postback on a button click, and then your ASP.NET code behind could generate CSS on the fly out of XML data. Yes, this is al could be possible, but, if you can use JavaScript, would look like a big overkill to me. I suggested much simpler and yet well maintainable solution, please see.
—SA

1 solution

Please see my article where I demonstrated probably the simplest possible method:
Theme Selector Based on HTML5 Local/Session Storage: The Simplest Thinkable One.

Note that required Web storage feature is not really related to HTML5 anymore:
http://www.w3.org/TR/webstorage,
http://en.wikipedia.org/wiki/Web_storage.

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900