ASP.net 2.0 secret reading notes three: Use theme design website

Source: Internet
Author: User

First, create a theme

You can create a theme by adding a folder to a folder named App_Themes application. Each folder that you add in App_Themes represents a topic.

The file types that are more important in the theme folder are skin files and CSS files.

Second, add skin to the theme

A topic may contain one or more skin files. You can modify all ASP.net control properties with skin effects through the skin.

For example, set the background color of all textbox controls in your Web application to yellow and select dotted as its border style. Create the simple folder under the App_Themes folder, and then create the Textbox.skin file in the simple folder, which looks like this:

<asp:textbox backcolor= "Yellow" borderstyle= "Dotter" runat= "Server"/>

Note that runat is required in the above code and cannot have an id attribute.

A theme folder can have one or hundreds of skin files, but all files under a theme folder will be compiled into a subject class.

The above theme folder simple if you want to use a theme of its definition on a page, use the following code:

<%@ Page language= "C #" theme= "simple"%>

If the TextBox control property enabletheming for the page is set to False, the theme does not work.

1. Create Named Skin

When defining a named skin is more SkinID than defining the default skin, the SkinID property of the specified control on the application theme page is the name of the SkinID property defined by the named skin.

2, Themes and Stylesheetthems

Using themes specifies that when a topic is applied, the theme defines that the skin overwrites the custom skin of the control in the page.

Using stylesheetthems specifies that it is not overwritten.

<%@ Page language= "C #" stylesheetthems= "simple"%>

3. Disable Skin

Each control contains a EnableTheming property, which is set to False to disable the theme skin.

4. Registering a theme in a Web configuration file

<system.web>

<pages theme= "simple"/>

</system.web>

After you enable a topic in a program, you can pass it in a specific page

<%@ Page language= "C #" enabletheming= "false"%>

To disable the theme.

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.