ASP.net 2.0 easy to achieve site change skin

Source: Internet
Author: User

First, Introduction:

With themes we can easily change the style of controls and pages without having to modify our code and page files. Themes files are separately placed under 1 App_Themes folders and are completely separate from your program.

Ii. How to use themes and skins:

Let's look at a very simple example:

App_themes\default\1.skin File Code:

<asp:Label Font-Bold="true" ForeColor="Red" runat="server" />
default.aspx:文件代码:
<% @ Page Language="C#" Theme="default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title>Page with Example Theme Applied</title>

<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text="Hello 1" /><br />
<asp:Label ID="Label2" runat="server" Text="Hello 2" /><br />
</form>
</body>

You can see that we didn't write a control style code in default.aspx, but running to find the word on the label became Bold Red, which is one of the most basic theme examples.

App_Themes folder:

The App_Themes folder is located under the root directory of the program, App_Themes must be a subfolder of the theme name, and a subfolder can contain multiple. Skin and. css files. The following figure establishes 2 theme, named Default and DEFAULT2:

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.