Reputation: 616
I have two css stylesheets one called blue.css
and one called red.css
. Both contain code for changing the background of a button blue.css
making the button blue and red.css
making the button red.
I have a drop down list which contains the colours red and blue and the background of the button changes to the option chosen. But when the website is revisted the button returns to the default grey colour. I know I have to create an SQL
database and somehow save the chosen value to the database so next time the site is run say for example: The default colour grey is shown and i choose red in the drop down list then i close the web page and then re open it and the background of the button is still red.
I know how to create tablea and edit them in SQL
but not sure how to get it working with my code. I am coding in c#
. If anyone can help it will be greatly appreciated :)
EDIT* I'm not allowed to use cookies for this
Upvotes: 0
Views: 655
Reputation: 29932
No you don't really need a database as you can store the information (blue.css
or red.css
) in a cookie. The cookie is even necessary if the data gets stored in a DB, because you need to identify the user. Then upon each request you can check for that cookie (either server-side via C# or client-side via JavaScript) and insert the according stylesheet.
Upvotes: 2