A master page can be created to hold those page elements that represent the common look and feel of a website. Once the common content is placed in the master page, the content pages (child pages) can inherit content from the master pages.
When a new content page is created, the developer simply needs to link it to an existing master page. When that content page is rendered, the content page and its associated master page will be "merged" at runtime. The resulting markup will contain all of the elements from the master page as well as those elements defined in the content page.The master page contains the form tags and content pages derived from that master page does not have form tag.
1.)What is Master Page in ASP.NET?
A Master page offers a template for one or more web forms. It defines placeholders for the content, which can be overridden by the content pages. The content pages contains only content. When users request the content page, ASP.NET merges the layout of the master page with the content of the content page and produce output.
When a new content page is created, the developer simply needs to link it to an existing master page. When that content page is rendered, the content page and its associated master page will be "merged" at runtime. The resulting markup will contain all of the elements from the master page as well as those elements defined in the content page.The master page contains the form tags and content pages derived from that master page does not have form tag.
1.)What is Master Page in ASP.NET?
A Master page offers a template for one or more web forms. It defines placeholders for the content, which can be overridden by the content pages. The content pages contains only content. When users request the content page, ASP.NET merges the layout of the master page with the content of the content page and produce output.
2.) Define Multiple Master Page.
In ASP.NET, you can have multiple master pages each for a different purpose. You can provide users several layout options using Multiple Master Page. You can define Master Page at multiple places in the web application.
You can specify page-level using the @Page dierective.
You can specify using the Web.config.
3.) Advantages of using Master Page in ASP.NET
Master pages enables consistent and standardized layout to the website.
You can make layout changes of the site in the master page instead of making change in the pages.
It is very easy to implement. It also reduces the Work.
4.) How is a Master Page different from an ASP.NET page?
The MasterPage has a @Master top directive and contains ContentPlaceHolder server controls. It is quiet similar to an ASP.NET page.
5.) How do you attach an exisiting page to a Master page?
By using the MasterPageFile attribute in the @Page directive and removing some markup.
6.) How do you set the title of an ASP.NET page that is attached to a Master Page?
By using the Title property of the @Page directive in the content page. Eg:
<@Page MasterPageFile="Sample.master" Title="I hold content" %>
7.) What is a nested master page? How do you create them?
A Nested master page is a master page associated with another master page. To create a nested master page, set the MasterPageFile attribute of the @Master directive to the name of the .master file of the base master page.
No comments:
Post a Comment