ASP. NET themes FAQ

Source: Internet
Author: User
1, What is the topic? A topic is composed of a group of elements: appearance and Cascading Style Sheets. (CSS) Images and other resources. The topic will contain at least the appearance. The subject is on the website or Web Defined in a special directory on the server. A topic is a group Web Control Set of properties, provides a simple way to set the style properties of the control.

·OnlyWeb ControlValid

·Motherboard page (Master pageThe topic cannot be set, but the topic can be set on the Content Page.

·TheWeb ControlOverwrite the style set on the page

:< span> if you set enabletheming =" false " , invalid topic

:< span> to dynamically set a topic on a page, you must go to the page lifecycle page_preinit before the event

:< span> topics include . skin and . CSS files

2,. SkinWhat is a file?. SkinIs an appearance file that contains various controls (for example,Button,Label,TextboxOrCalendarControl. The control appearance settings are similar to the control markup, but only include the attributes you want to set as part of the topic. For exampleButton Widget appearance:

<Asp: button runat = "server" backcolor = "lightblue" forecolor = "black"/>

in theme Create in folder . skin file. A . Skin file can contain the appearance of one or more controls of one or more control types. You can define the appearance of each control in a separate file, or you can define the appearance of all themes in a file. There are two types of control appearances - default appearances and named appearances ":

:< span> when a topic is applied to a page, the default appearance is automatically applied to all controls of the same type. If the widget does not appear skinid property, is the default appearance. For example, if you create a default appearance for the calendar control, the control appears to apply to all calendar controls on pages that use this topic. (The default appearance is strictly matched by the control type, therefore, the button control appears for all button controls, but not applicable to linkbutton controls or controls derived from button objects .)

·The named appearance is setSkinidProperties. Named appearances are not automatically applied to controls by type. Instead, you should setSkinidProperty explicitly applies the named appearance to the control. By creating a named appearance, you canProgramDifferent instances of the same control in.

3,How to define differentSkinUseSkinidDefine differentSkinFor example

<Asp: Label runat = server text = "themedlabel" backcolor = "red"/>-labelDefault appearance<Asp: Label runat = server skinid = "boldlabel" text = "themedlabel_withskinid" backcolor = "blue" font-bold = "true"/>-Name itBoldlabelOfLabelAppearance

Therefore, the page is not specifiedSkinidOfLabelDefault appearance of automatic application,LabelOfSkinidSetBoldlabelOfLabelControl ApplicationBoldlabelAppearance

4,How to organize theme File ContentThemeFiles can contain multiple. SkinFile, so you can organize your theme files in multiple ways. All theme files will be merged before they are applied to the page.

·One. SkinFile contains the appearance definitions of all controls

·Each control has one. SkinFile

·SameSkinidPut. SkinFile

5,Is there a way to define it?ThemeFiles are shared among multiple programs.Global themes can be referenced by any website on the server and any page on any website. Global themes can be shared among applications. For example, you want to create a global shared topic.Theme1.IISThe placement of global themes on the server is similar\ Inetpub \ wwwroot \ aspnet_client \ system_web \ v2.0.xxxxx \ themes \ theme1

Application-level topics cover global topics. For example, you have definedTheme1In the application-levelTheme1The topic will cover the global topic.Theme1

 

6. stylesheettheme what is A topic can also contain Cascading Style Sheets (. CSS file ). When you place the . CSS file in the topic directory, the style sheet is automatically applied as part of the topic. Use the file extension . CSS to define a style sheet in the theme folder. Set the stylesheettheme attribute of the page to apply a topic as a style sheet topic. If you want to be able to set the attributes of each control on the page and still apply themes to the overall appearance, you can apply themes as style sheet themes. enabletheming = "false" the stylesheettheme still works. Dynamic Modification of theme styles on a page by overwriting properties stylesheettheme

Public override string stylesheettheme
{< br> get {retrun" mystylesheettheme ";}
}

7. theme ( theme/skin ) resource A pretty good group theme , can be directly applied to project development

theme preview:
theme download: http://www.dotnettreats.com/tools/Default.aspxhttp://www.dotnettreats.com/SampleThemes/Default.aspx original link address: http://shanyou.blog.51cto.com/363653/74943

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.