July 24th, 2004, 11:30 AM
select and remember css
Is it possible to have 3 buttons, images, or links which change to a different stylesheet at runtime?
E.g. link1 for style1.css, link2 for style2.css etc
Once the stylesheet has been selected by the user, how do you get it to remember the selected stylesheet, so the nexttime the user visits, the last selected stylesheet is loaded?
im guessing i will have to use sessions or cookies, but how?
can anyone help out?
July 25th, 2004, 11:59 PM
To remember the last used style sheet, you can store them in the cookie via the Response object:
// C# code
Response.Cookies.Add(new HttpCookie("A_NAME", "A_Value_To_Be_Stored"));
However, this may not work if the web client has cookie disabled. So a better way of doing it is to store the value in the server side, say in a database or simple a plain text file.
July 26th, 2004, 04:25 AM