asp.net 2.0 (C #) (2)

Source: Internet
Author: User

Introduced

Using the theme feature of ASP.net 2.0, you can break down styles and layout information into separate filegroups, collectively referred to as "themes." The theme can then be applied to any site, affecting the appearance of pages and controls in the site. This way, you can easily maintain style changes to your site by changing the theme without having to edit the pages of the site. You can also share topics with other developers.

The essential

1, add the App_Themes folder to the Web site, you can add the. skin file, the. css file in each theme file (after you specify the theme, automatically load all the. css files under the theme) or picture files

2, under the web.config <system.web> element under the <pages> element to set the theme or StyleSheetTheme properties (for the global) Set the theme or StyleSheetTheme attribute in the page's @page directive (for the current page)

3, theme defined style can not be overridden; StyleSheetTheme defined styles can override

4,. skin file is not set SkinID is the default, set the SkinID SkinID properties of the corresponding control

5, dynamically modify the page theme to be implemented in the Page_PreInit method

Example

Blue Theme

<asp:label runat= "Server" backcolor= "Blue" forecolor= "white"/> <asp:label runat=
"Server" backcolor= Darkblue "forecolor=" white "skinid=" Dark "/> <%--imageurl the
following settings resolve to images files Pic.jpg folder under this topic--%>
<asp:image runat= "Server" imageurl= "Images/pic.jpg"/>  

Red theme

<asp:label runat= "Server" backcolor= "Red" forecolor= "white"/> <asp:label runat=
"Server" backcolor= " Darkred "forecolor=" white "skinid=" Dark "/> <%--imageurl the
following settings resolve to images files Pic.jpg folder under this topic--%>
<asp:image runat= "Server" imageurl= "Images/pic.jpg"/>  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.