When creating a project, you are required to select your preferred topic. After a simple query of the information, the idea is basically as follows:
1. The database customer table has a field (temporarily named theme), which specifically records Customers' favorite topics.
2. After the customer logs on for the first time, the website displays the default theme mode, creates a session, queries the database, and assigns values to it (of course, the default value for the theme field of the new customer is default ). Based on the subject selected by the customer, you can save the subject to the database while changing the subject of the website. This topic is displayed after you log on again.
So the key point is how to dynamically change the subject of the entire website?
I use this solution:
1. Create a themepage class inherited from system. Web. UI. Page. This class overrides the onpreinit method:
1 protected overrides sub onpreinit () sub onpreinit (byval e as eventargs)
2 mybase. onpreinit (E)
3
4 if not SESSION ("theme") is nothing then
5 page. theme = SESSION ("theme ")
6 end if
7end sub
8
2. inherit all other pages from the themepage class, except for the logon page.
3. On the switch topic page, perform the following operations:
1if ddltheme. selectedindex = 0 then
2 SESSION ("theme") = "default" 'use the default theme
3 else
4 Session ("theme") = ddltheme. selectedvalue
5end if
6 updatetheme () 'store to database
Refresh the current page to display a new topic. You can do this:
Server. Transfer (request. filepath)
In this way, the dynamic global change of the topic can be realized. I hope to give you some reference. If there is a better method, please do not give me any further advice.
In addition, some technologies on ASP. NET topics are provided.Article:
Http://msdn2.microsoft.com/en-us/library/ms379601 (vs.80). aspx
Http://www.dedecms.com/web-art/Asp_Netjiaocheng/20060819/21832.html
Http://www.codeproject.com/useritems/dynamicThemes.asp
Http://www.codeproject.com/aspnet/ThemesAndSkins.asp