master pages macdonald ch. 13 mis 324 mis 324 professor sandvig professor sandvig
TRANSCRIPT
Master PagesMaster PagesMacDonald Ch. 13MacDonald Ch. 13
MIS 324
Professor Sandvig
OutlineOutline
1.1. Why Master Pages?Why Master Pages?
2.2. SyntaxSyntax
3.3. ExampleExample
Benefits of Master PagesBenefits of Master Pages
Create a template for site layoutCreate a template for site layout Defined in one place, rather than each pageDefined in one place, rather than each page
Include “Placeholders” for page-specific Include “Placeholders” for page-specific contentcontent
Individual pages inherit layout from masterIndividual pages inherit layout from master Eliminates last place where code was Eliminates last place where code was
duplicatedduplicated
SyntaxSyntax
Create master pageCreate master page .master extension.master extension Directive: <%@ master %>Directive: <%@ master %> Include common contentInclude common content
• headers, footers, menus, layout, etc.headers, footers, menus, layout, etc. Include placeholder controls for page contentInclude placeholder controls for page content
SyntaxSyntax
.aspx pages.aspx pages Reference master page in page directiveReference master page in page directive Include “content” controlsInclude “content” controls
• Provides contentProvides content• Map to placeholders in .master pageMap to placeholders in .master page
VS SupportVS Support
VS SupportVS Support
SyntaxSyntax
Default ContentDefault Content Include in master pageInclude in master page Used when .aspx page does not provide Used when .aspx page does not provide
content.content. Example: Example:
• Florist: Florist: default.aspx• Source: masterPage.master.txt, daisy.aspx.txtSource: masterPage.master.txt, daisy.aspx.txt
MasterPages: Other FeaturesMasterPages: Other Features NestingNesting
Sub-masters inherit from .masterSub-masters inherit from .master Add more placeholdersAdd more placeholders
Programmatic access to master pageProgrammatic access to master page Change items from .aspx pageChange items from .aspx page
• meta tagsmeta tags• style sheet …style sheet …
Navigation ControlsNavigation Controls Extensive integration with MasterPagesExtensive integration with MasterPages
• Page titles, formatting, etc.Page titles, formatting, etc.
Example: ISC web siteExample: ISC web site
SummarySummary
Master PagesMaster Pages Handy new featureHandy new feature Easy to useEasy to use