asp.net
ASP.net 2.0 adds a new Theme feature that makes it easier for Web sites to change skin.
The implementation of Theme includes: CSS, Skin, MasterPage.
CSS is used to control the appearance of all HTML tags.
Skin is used to control the appearance of all ASP.net server adjustments and can define its CSS styles through property cssClass.
MasterPage is a *.aspx page template, but it is not defined in Theme.
------------------------------------------------
• Create an example of Theme:
1, create the App_Themes directory in the Web project. It is a predefined directory, and ASP.net 2.0 automatically identifies the Theme in its directory.
2, in the App_Themes directory to create Orangetheme, bluetheme two subdirectories.
3. Add Skin files for each subdirectory under App_Themes, such as Control.skin. ASP.net 2.0 automatically analyzes each Skin file, where the name only needs to be easy to categorize for development.
4, you can also add CSS files for each subdirectory under App_Themes. ASP.net 2.0 will also automatically add each CSS file to every page that uses this style.
• Define page content and Theme style
1, Default.aspx page definition is as follows:
<%@ Page theme= "Orangetheme"%>
<title>orange page</title>
<body>
<form id= "Form1" runat= "Server" >
Enter your name:<br/>
<asp:textbox id= "txtname" runat= "Server"/>
<br/><br/>
<asp:button id= "btnsubmit" text= "Submit Name" runat= "Server"/>
</form>
</body>
2. The Control.skin file in the Orangetheme homepage is defined as follows:
Note: You can only specify appearance attributes, and you cannot specify properties such as Autopastback.
The default unnamed Skin will define skins for all TextBox types.
<asp:textbox backcolor= "Orange" forecolor= "Darkgreen" runat= "Server"/>
<asp:button backcolor= "Orange" forecolor= "Darkgreen" font-bold= "True" runat= "Server"/>
The named SkinID will be able to define the appearance for the specified TextBox type.
<asp:textbox skinid= "Title" backcolor= "Orange" forecolor= "Darkgreen" runat= "Server"/>
• Use Theme in the page
1, add the Theme= "Default" attribute to the top of the Aspx file <%@ Page%>. This allows it to use the Default theme.
2, if you think of the entire site to apply a Theme need to be defined in Web.config.
<configuration>
<system.web>
<pages theme= "Orangetheme"/>
</system.web>
</configuration>
This definition is equivalent to the default one Theme in all Web site files, you can still define Theme for each page when you use it.
The Skin section uses the Theme defined in the page surface, and CSS overloads the CSS style sheet in the default home page.
3, after the designation good Theme all appearance will use Skin to define. You can also specify the SkinID of the control to define a separate appearance.
4, if you want to programmatically define Theme must be handled in the Page_PreInit event, as follows:
void Page_PreInit (object sender, EventArgs e)
{
Page.theme = request["ThemeName"];
This definition is also required if you need to programmatically load the MasterPage file for the Page.
This. MasterPageFile = request["MasterPageFile"];
}
Understanding these technologies will make the site more changeable.