Designing Websites with Master Pages - Placement questions
Q.1 What is/are the advantages of master page?
A) It helps to display common content in multiple pages.
B) They allow you to centralize the common functionality of your pages so that you can make updates in just one place.
C) It helps to create a common page layout.
D) All of the above.
View Answer / Hide AnswerQ.2 What is/are true about master page?
A) Master page contains a <%@ Master %> directive instead of the normal <%@ Page %> directive.
B) ContentPlaceHolder control can be added only on master page.
C) You can add as many ContentPlaceHolders to a Master Page as you need.
D) All of the above.
View Answer / Hide AnswerQ.3 Which control is required inside a content page to reference ContentPlaceHolder control inside the master page?
A) Content control on a content page.
B) ContentPlaceHolder on a content page.
C) PlaceHolder control is required on content page.
D) None of the above.
View Answer / Hide AnswerQ.4 What is/are true about master page? Choose the correct option.
A) You can add more than one master page in a website.
B) Master page can be nested.
C) ContentPlaceHolder control is required on a content page.
D) Both A and B option are correct.
View Answer / Hide AnswerQ.5 Choose the correct option about master page and theme.
A) A Master Page enables you to share content across multiple pages in a website and A Theme enables you to control the appearance of the content.
B) Theme enables you to share content across multiple pages in a website and A Master Page enables you to control the appearance of the content.
C) App_Themes folder contains skin files.
D) Option A and C are correct.
View Answer / Hide AnswerQ.6 Which of the following is a valid skin code inside a skin fi le?
A) <asp:TextBox BackColor=”Yellow” BorderStyle=”Dotted” ID=”colorTxt” Runat=”Server”/>
B) <asp:TextBox BackColor=”Yellow” BorderStyle=”Dotted” Runat=”Server” />
C) <asp:TextBox BackColor=”Yellow” BorderStyle=”Dotted” ID=”colorTxt” />
D) None of the above.
View Answer / Hide AnswerANSWER: B
Explanation:
You must always include a Runat=”server” attribute, but you can never include the ID attribute when declaring a control in a Skin.
Q.7 Theme can be applied at which level?
A) Page level
B) Site level (through the Web.config file).
C) Individual control level.
D) All of the above.
View Answer / Hide AnswerQ.8 You need to allow users to choose their own themes. In which page event will you write the user-selected theme?
A) Page_Load
B) Page_Render
C) Page_PreInit
D) Page_PreRender
View Answer / Hide AnswerANSWER: C
Explanation:
To apply a theme programmatically, you can use to set the page’s Theme property in the Page_PreInit method. Page_PreInit is the proper method in which to specify the theme.
Q.9 Which of the following statements about referencing master page methods and properties is true?
A) Content pages can reference controls in the master page.
B) Content pages can reference public properties in the master page.
C) Content pages can reference public methods in the master page.
D) All of the above.
View Answer / Hide AnswerQ.10 What are the basic steps to reference master page properties from a content page?
A)
- Create a property in the master page code-behind file.
- Reference the master page property from the content page using the syntax Master.<Property_Name>.
B)
- Create a property in the master page code-behind file.
- Add the @ MasterType declaration to the .aspx content page.
- Reference the master page property from the content page using the syntax Master.<Property_Name>.
C)
- Create a property in the master page code-behind file.
- Reference the master page property from the content page using the syntax Master.<Property_Name>.
D) None of the above.
View Answer / Hide AnswerANSWER: B
Explanation:
Steps to reference master page properties from a content page are as follows.
Step 1:
Create a property in the master page code-behind file. Here the name of master page is MasterPage.master
string WSname;
public string WebSiteName
{
get { return WSname; }
set { WSname = value; }
}
Step 2:
Add the @ MasterType declaration to the .aspx content page.
<%@ MasterType VirtualPath="~/MasterPage.master" %>
Step 3:
Reference the master page property from the content page using the syntax Master.<Property_Name>.
Master.WebSiteName = "CareerRide";
Label1.Text = Master.WebSiteName;