Editing Master Pages in the Visual Web Developer Designer
Visual Web Developer helps you design master pages and content pages by providing visual representations and markup validation for master and content pages.
When you use Visual Web Developer commands to create a new master page, the master page template contains the @ Master directive that defines the page as a master page. Any page with the @ Master directive and with the extension .master will be recognized as a master page by the Web page designer.
When you are editing a master page, the designer assists you in these ways:
In Source view, the editor checks the page markup to be sure that you do not add elements or attributes that are not valid in master pages. For example, if you add a Content control to a master page in Source view, the editor will mark the control because Content controls are not allowed in master pages.
When you are editing a master page in the designer, the Web site menu and right-click menu contain the command Add Content Page, which creates a new page that is already linked to the current master page.
Content pages can contain only Content controls with page-specific content. The designer enforces this schema to help you avoid run-time errors.
If you associate a content page with a master page when first creating the content page in Visual Web Developer, the designer infers Content controls based on the ContentPlaceHolder controls in the linked master page. For example, if the master page has two ContentPlaceHolder controls, the designer creates two Content controls in the new content page.
The Content control does not appear in the Toolbox. It cannot be added to master pages, and in content pages, the designer automatically infers Content controls. If you remove an automatically added Content control, you must replace it in Source view.
When you add markup or controls to the Content controls in the content page, you are overriding the default master content in the corresponding ContentPlaceHolder control. If you want to use the default master page content instead, in Design view you can right-click the Content control and click Default to Master's Content. The designer removes the Content control, which has the effect of allowing the corresponding ContentPlaceHolder control on the master page to provide the content.
In Design view, you can determine whether the text and controls displayed in a Content controls are default master page content by looking at the control's title bar. If the title bar includes the word (Master), the control is displaying default content. If the title bar includes the word (Custom), the control is displaying the text and controls that were added in the content page.
In Source view, the editor checks your markup to be sure you do not add text or controls outside of Content controls.
You cannot add themes to master pages. However, you can add themes to content pages or specify a site-wide theme in the Web.config file.
In Design view, the designer will display themed controls differently depending on a number of factors:
If a theme is applied to the content page as a style-sheet theme, master pages and content pages are displayed in Design view with skin definitions from the theme. If the style-sheet theme is applied in the Web.config file, the designer also displays themed controls when you edit the master page. Whether the style sheet theme is applied in the content page or in the Web.config file, the designer displays themed controls when you edit content pages.
If the theme is defined as a theme (not a style-sheet theme) in the content page, the designer does not apply the theme in Design view. Any controls with skin definitions are displayed using their default appearance.
For more information, see ASP.NET Themes and Skins Overview.