Theme, skin -- ASP. net2.0 New Login log

Source: Internet
Author: User
ArticleDirectory
    • (3) * put. CSS into the theme directory for Reference
    • Notes
Theme
Page without theme
    • The structure is complex and the format is messy, so it is not easy to modify and read.

Page using theme

    • The structure is clear, easy to modify and read, and easy to reuse.
App_themes is a folder in the *. aspx directory of the same level. This folder can contain multiple folders.
Each folder corresponds to a separate theme. Each theme directory can have two types of files.
1. *. CSS: used to modify the HTML control and Asp.net control in *. aspx.
    • *. Attributes of HTML controls that can be modified by CSS

How to modify HTML controls
(1)CodeDirectly through the style attribute

<Button id = "button1" style = "Font: 8pt verdana; Background-color: lightgreen; border-color: black; width: 100" runat = "server"> click me! </Button>
(2) define the style attribute in the Code and reference the Modifier

 
<HTML>  
(3) * put. CSS into the theme directory for Reference
<% @ Page Language = "VB" masterpagefile = "~ /Masterpage. master "autoeventwireup =" false "codefile =" newpage1.aspx. VB "inherits =" newpage1 "Title =" untitled page "theme =" themea "%> <asp: content ID = "content1" contentplaceholderid = "contentplaceholder1" runat = "server"> <asp: label id = "label1" runat = "server" text = "label" class = "spanstyle"> </ASP: Label> </ASP: content>
2. *. Skin is used to modify the Asp.net control in *. aspx.
    • . Skin content

Eg:

<Asp: label font-bold = "true" forecolor = "orange" runat = "server"/> <asp: calendar backcolor = "white" bordercolor = "black" borderstyle = "solid" cellspacing = "1" font-names = "verdana" font-size = "9pt" forecolor = "black" height = "250px" nextprevformat = "shortmonth" width = "330px" runat = "server"> <selecteddaystyle backcolor = "#333399" forecolor = "white"/> <othermonthdaystyle forecolor = "#999999"/> <todaydaystyle backcolor = "#999999" forecolor = "white"/> <daystyle backcolor = "# cccccccc"/> <nextprevstyle font-bold = "true" font-size = "8pt" forecolor = "white"/> <dayheaderstyle font-bold = "true" font-size = "8pt" forecolor = "#333333" Height = "8pt "/> <titlestyle backcolor =" #333399 "borderstyle =" solid "font-bold =" true "font-size =" 12pt "forecolor =" white "Height =" 12pt" /> </ASP: calendar> <asp: gridview cellpadding = "4" forecolor = "#333333" gridlines = "NONE" width = "461px" runat = "server"> <footerstyle backcolor = "#1c5e55" font-bold = "True" forecolor = "white"/> <rowstyle backcolor = "# e3eaeb"/> <pagerstyle backcolor = "#666666" forecolor = "white" horizontalalign = "center"/> <selectedrowstyle backcolor = "# c5bbaf" font-bold = "true" forecolor = "#333333"/> (1) directly use skin through theme in the aspx File

For example: 1. The content of aspx, after the first line declares theme1, all ASP controls will be presented using the skin defined in theme1

<% @ Page Language = "VB" theme = "theme1" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.1 // en" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml"> (2) Select skin in the aspx file.

For example: Skin content in theme2, a calendar is specified with skinid = "simple"

<Asp: calendar runat = "server" backcolor = "# ffffcc" bordercolor = "# ffcc66" borderwidth = "1px" daynameformat = "firstletter" font-names = "verdana" font-size =" 8pt "forecolor =" #663399 "Height =" 200px "showgridlines =" true "width =" 220px "> <selecteddaystyle backcolor =" # ccccff "font-bold =" true "/> <selectorstyle backcolor = "# ffcc66"/> <othermonthdaystyle forecolor = "# cc9966"/> <todaydaystyle backcolor = "# ffcc66" forecolor = "white"/> <nextprevstyle font- size = "9pt" forecolor = "# ffffcc"/> <dayheaderstyle backcolor = "# ffcc66" font-bold = "true" Height = "1px"/> <titlestyle backcolor =" #990000 "font-bold =" true "font-size =" 9pt "forecolor =" # ffffcc "/> </ASP: calendar> <asp: calendar skinid = "simple" runat = "server" backcolor = "white" bordercolor = "#999999" cellpadding = "4" daynameformat = "firstletter" font-names = "verdana" font -size = "8pt" forecolor = "black" Height = "180px" width = "200px"> <selecteddaystyle backcolor = "#666666" font-bold = "true" forecolor =" white "/> <selectorstyle backcolor =" # cccccc "/> <weekenddaystyle backcolor =" # ffffcc "/> <othermonthdaystyle forecolor =" #808080 "/> <todaydaystyle backcolor = "# cccccc "forecolor =" black "/> <nextprevstyle verticalalign =" bottom "/> <dayheaderstyle backcolor =" # cccccccc "font-bold =" true "font-size =" 7pt" /> <titlestyle backcolor = "#999999" bordercolor = "black" font-bold = "true"/> </ASP: calendar>

2. the content of Aspx. After theme1 is declared in the first line, the ASP control can select skin by specifying the skinid, the ASP control that does not specify the skinid will use the default skin defined in theme for presentation.

 
<% @ Page Language = "VB" theme = "theme1" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.1 // en" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">  
Notes
    • 1. once theme = is used to define the theme of a page, the Property setting of the control on the page fails. If you want the Property setting to take effect on the page, you must use sytlesheettheme = to define theme instead of directly using theme.

Eg:

<% @ Page Language = "VB" stylesheettheme = "theme2" %> <! Doctype HTML public "-// W3C // dtd xhtml 1.1 // en" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml">  
    • 2. Set in Web. config to allow the entire web site to use skin
 
<Configuration> <system. Web> <pages theme = "basicblue"/> </system. Web> </configuration>
    • 3. dynamically set theme through code
 
Void page_preinit (Object sender, eventargs e) {page. theme = "basicblue ";}
    • 4. enabletheming attributes

Setting the enabletheming attribute to false can be a separate control or disable the theme function on the entire page.

 
<Asp: dropdownlist id = "countries" enabletheming = "false" runat = "server"/>
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.