1- Describe the difference between the Page directive’s Theme and StyleSheetThem
ID: 3683753 • Letter: 1
Question
1- Describe the difference between the Page directive’s Theme and StyleSheetTheme attributes.
2- For a theme to work, where must you store the theme’s skin file(s)? In your answer, you must describe the full path to the skin file(s), and in your description, you must mention 3 folders/directories.
3- Provide an example of a single skin definition.
4- What is the purpose of a SkinID?
5- Describe the relationship between a master page and a content page.
6- In a content page’s Page directive, what does it mean to use ~ (tilde) in the MasterPageFile attribute’s value?
Explanation / Answer
1)
The Page directive includes the attribute Theme and StylesheetTheme.You can use both to apply themes to a page. So, the question is: If you have a Themeattribute and a StylesheetTheme attribute for the Page directive, what is the difference between the two?
<%@ Page Language=”VB” StylesheetTheme=”Theme1” %>
The StylesheetTheme attribute works the same as the Theme attribute. The difference is that the when attributes are set locally on the page within a particular control, the attributes are overridden by the theme if you use the Theme attribute. They are kept in place, however, if you apply the page’s theme using the StylesheetTheme attribute. Suppose you have a text box control like the following:
<asp:Textbox ID=”TextBox1” Runat=”server” ForeColor=”#ffffff” />
In this example, the ForeColor settings is overridden by the theme if you have applied theme using the Theme attribute in the Page directive. If, you applied the theme using the StylesheetTheme attribute in the Page directive, the ForeColor settings remain in place, even if they are explicitly defined in the theme.
4) Purpose of SkinID :
A skin file has the file name extension .skin and contains property settings for individual controls such as Button, Label, TextBox, or Calendarcontrols. Control skin settings are like the control markup itself, but contain only the properties you want to set as part of the theme. For example, the following is a control skin for a Button control:
You create .skin files in the Theme folder. A .skin file can contain one or more control skins for one or more control types. You can define skins in a separate file for each control or define all the skins for a theme in a single file.
There are two types of control skins, default skins and named skins:
A default skin automatically applies to all controls of the same type when a theme is applied to a page. A control skin is a default skin if it does not have a SkinID attribute. For example, if you create a default skin for a Calendar control, the control skin applies to all Calendarcontrols on pages that use the theme. (Default skins are matched exactly by control type, so that a Button control skin applies to allButton controls, but not to LinkButton controls or to controls that derive from the Button object.)
A named skin is a control skin with a SkinID property set. Named skins do not automatically apply to controls by type. Instead, you explicitly apply a named skin to a control by setting the control's SkinID property. Creating named skins allows you to set different skins for different instances of the same control in an application.
5)
- MasterPage.master is the file name of the master page. This directive enables a “Master object” on the content page that provides a programming interface for the interaction. Based on Microsoft documentation, the Masteris a property of the Page class. Since it behaves like an object, for readability, let's call it the Master object.
- Secondly, expose the server controls on the master page by means of public properties and methods. These properties and methods are presented as public members of the Master object on the content page. The content page communicates with the master page by accessing the properties and methods.
- Thirdly, wire the events of the master page’s server controls on to the content page via the Master object. The master page communicates with the content page through the event handlers.
- The basic interaction between a content page and a master would be either the content page communicating with the master page or the master page talking to the content page. To illustrate how the interaction really works, a demo application is prepared for download.
- The server controls on a master page are local to the master page, which are not accessible by a content page. To make them accessible, the server controls need to be exposed as public properties or methods. The following code sample creates four public properties for the two TextBoxes and two Buttons on the master page and also exposes four methods that assign values or retrieve values for the TextBoxes.
-For clarity, the word “Property” is added to the front of each property name. Depending on project needs, the properties can be read only, write only, or read and write. More methods can also be implemented, if needed.
- To make a master page interact with a content page, the event of a server control on the master page needs to be wired on to the content page. A corresponding event handler should also be implemented on the content page.
<%@ Page Language=”VB” StylesheetTheme=”Theme1” %>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.