In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what is the function of Theme of ASP.NET". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Theme has been added to ASP.NET 2.0, which makes it easier for websites to change their skin.
The implementation of Theme includes: CSS, Skin, MasterPage.
CSS is used to control the appearance of all HTML tags.
Skin is used to control the appearance of all ASP.NET server adjustments, and its CSS style can be defined through the property cssClass.
MasterPage is a * .aspx page template, but it is not defined in Theme.
Examples of ◆ ASP.NET development techniques for creating ASP.NET Theme:
1. Create an App_Themes directory in the Web project. It is a predefined directory, and ASP.NET 2.0 automatically recognizes the Theme in its directory.
2. Create orangeTheme and BlueTheme subdirectories in the App_Themes directory.
3. Add Skin files, such as Control.Skin, for each subdirectory under App_Themes. ASP.NET 2.0 automatically parses every Skin file, and it is named here only for easy classification at development time.
4. You can also add CSS files to each subdirectory under App_Themes. ASP.NET 2.0 also automatically adds every CSS file to every page that uses this style.
Definition of ◆ ASP.NET Development skills Page content and ASP.NET Theme style
1. The default.aspx page is defined as follows:
<% @ Page Theme= "OrangeTheme"% > < html > < head runat= "server" > < title > Orange Page < / title > < / head > < body > < form id= "form1" runat= "server" > Enter your name: < br / > < asp:TextBox ID= "txtName" Runat= "Server" / > < br / > < asp:Button ID= "btnSubmit" Text= "Submit Name" Runat= "Server" / > < / form > < / body > < / html >
2. The definition in the Control.Skin file of the OrangeTheme home page is as follows:
Note: only appearance properties can be specified, not properties such as AutoPastback.
/ / the default unnamed Skin will define skins for all TextBox types. < asp:TextBox BackColor= "Orange" ForeColor= "DarkGreen" Runat= "Server" / > < asp:Button BackColor= "Orange" ForeColor= "DarkGreen" Font-Bold= "True" Runat= "Server" / > / / those who have named SkinID will be able to define the appearance for the specified TextBox type. < asp:TextBox SkinID= Title "BackColor=" Orange "ForeColor=" DarkGreen "Runat=" Server "/ >
◆ ASP.NET Development skills: using ASP.NET Theme in pages
1. Add the Theme= "Default" attribute to <% @ Page% > at the top of the Aspx file. So it can use the Default theme.
2. If you want to apply a Theme to the entire site, you need to define it in Web.Config.
< configuration > < system.web > < pages theme= "OrangeTheme" / > < / system.web > < / configuration >
Such a definition is equivalent to a default Theme in all site files, and you can still define a Theme for each page when you use it.
The Skin section uses the Theme defined in the Page face, while CSS overloads the CSS stylesheet in the default home page.
3. After specifying the Theme, all appearances will be defined in Skin. You can also specify the SkinID of the control to define a separate appearance.
4. If you want to define Theme programmatically, you must handle it in the Page_PreInit event, as follows:
Void Page_PreInit (object sender, EventArgs e) {Page.Theme = Request ["ThemeName"]; / / if you need to load the MasterPage file for Page programmatically, you also need to define it here. This.MasterPageFile = Request ["MasterPageFile"];} the content of "what is the function of ASP.NET 's Theme" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.