SlideShare a Scribd company logo
1 of 16
BY-Teach4u.in
Master pages
Master page defines a combination of fixed content
and content place holder to hold the web page(.aspx)
Master Page
An ASP.NET file with a .master file extension. A
master page contains a layout that includes text,
HTML, and server controls. Instead of an “@ Page”
directive, it contains an “@ Master” directive. The
master page contains all top-level HTML elements for a
page, including <html>, <head>, and <form>. A master
page typically includes the page structure (usually an
HTML table), company name and logo, and site
navigation. To enable pages to insert content, a master
page contains one or more ContentPlaceHolder
controls. A master page inherits from the MasterPage
class.
Content Page
A content page defines the ContentPlaceHolder
controls in a master page, essentially filling in the
blanks. A content page is a standard .aspx file and is
bound to the master page using the MasterPageFile
attribute in the “@ Page” directive.
Master pages provide templates that you can use to
create consistent Web pages throughout an
application.
continued
To use master pages, first create a master page and
add layout tables and other common elements. Then
add ContentPlaceHolder controls to the master page.
To create the content pages, add standard Web forms,
select the master page check box when creating the
page, select the master page, and then add content to
the page.
Master pages
To reference public properties in a master page, add
the “@ MasterType” declaration to the content page
and reference the property using
Master.Property_Name. To reference controls in a
master page, call Master.FindControl from the content
page.
Master pages
ASP.NET master pages allow you to create a consistent layout for the
pages in your application. A single master page defines the look and
feel and standard behavior that you want for all of the pages (or a
group of pages) in your application. You can then create individual
content pages that contain the content you want to display. When
users request the content pages, they merge with the master page to
produce output that combines the layout of the master page with the
content from the content page.
How master page works
A master page is an ASP.NET file with the extension
.master (for example, MySite.master) with a predefined
layout that can include static text, HTML elements, and
server controls. The master page is identified by a
special @ Master directive that replaces the @ Page
directive that is used for ordinary .aspx pages. The
directive looks like the following.
 <%@ Master Language="C#" CodeFile="MasterPage.master.cs"
Inherits="MasterPage" %>
Content page
You define the content for the master page's
placeholder controls by creating individual content
pages, which are ASP.NET pages (.aspx files and,
optionally, code-behind files) that are bound to a
specific master page. The binding is established in the
content page's @ Page directive by including a
MasterPageFile attribute that points to the master
page to be used. For example, a content page might
have the following @ Page directive, which binds it to
the Master1.master page.
<%@ Page Language="C#"
MasterPageFile="~/MasterPages/Master1.master" Title="Content
Page"%>
Replaceable content placeholder control
 These placeholder controls define regions where replaceable content will appear.
 <%@ Master Language="C#" %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" >
 <head runat="server" >
 <title>Master page title</title>
 </head>
 <body>
 <form id="form1" runat="server">
 <table>
 <tr>
 <td><asp:contentplaceholder id="Main" runat="server" /></td>
 <td><asp:contentplaceholder id="Footer" runat="server" /></td>
 </tr>
 </table>
 </form>
 </body>
 </html>
Content page
Advantages of master pages
They allow you to centralize the common functionality of
your pages so that you can make updates in just one place.
They make it easy to create one set of controls and code
and apply the results to a set of pages. For example, you
can use controls on the master page to create a menu that
applies to all pages.
They give you fine-grained control over the layout of the
final page by allowing you to control how the placeholder
controls are rendered.
They provide an object model that allows you to
customize the master page from individual content pages.
Run time behaviour of the master page
At run time, master pages are handled in the following sequence:
1.Users request a page by typing the URL of the content page.
2.When the page is fetched, the @ Page directive is read. If the
directive references a master page, the master page is read as well.
If this is the first time the pages have been requested, both pages
are compiled.
3.The master page with the updated content is merged into the
control tree of the content page.
4.The content of individual Content controls is merged into the
corresponding ContentPlaceHolder control in the master page.
5.The resulting merged page is rendered to the browser
Run time behaviour of the master page
Themes and skin files
Themes are a feature similar to style sheets as they
help to supply a standard look and feel to web
controls. You can use CSS style sheets to supply styles
to HTML elements but if you wanted to use a set of
predefined styling attributes to your web controls
then you should use a Theme.


More Related Content

What's hot

What's hot (20)

Html links
Html linksHtml links
Html links
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Advanced Cascading Style Sheets
Advanced Cascading Style SheetsAdvanced Cascading Style Sheets
Advanced Cascading Style Sheets
 
Css lecture notes
Css lecture notesCss lecture notes
Css lecture notes
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Introducing CSS Grid
Introducing CSS GridIntroducing CSS Grid
Introducing CSS Grid
 
Css
CssCss
Css
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
 
Java script
Java scriptJava script
Java script
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Css selectors
Css selectorsCss selectors
Css selectors
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
CSS Grid
CSS GridCSS Grid
CSS Grid
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
MySQL
MySQLMySQL
MySQL
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 

Viewers also liked

Master pages ppt
Master pages pptMaster pages ppt
Master pages ppt
Iblesoft
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
sasidhar
 
Formbased authentication in asp.net
Formbased authentication in asp.netFormbased authentication in asp.net
Formbased authentication in asp.net
parallelminder
 
Restoring SharePoint Frontend server
Restoring SharePoint Frontend serverRestoring SharePoint Frontend server
Restoring SharePoint Frontend server
parallelminder
 
EUGM15 - Zoltán Simon (Printnet): Drug Profile Matching - Drug Discovery by P...
EUGM15 - Zoltán Simon (Printnet): Drug Profile Matching - Drug Discovery by P...EUGM15 - Zoltán Simon (Printnet): Drug Profile Matching - Drug Discovery by P...
EUGM15 - Zoltán Simon (Printnet): Drug Profile Matching - Drug Discovery by P...
ChemAxon
 

Viewers also liked (20)

Master pages ppt
Master pages pptMaster pages ppt
Master pages ppt
 
Master Pages In Asp.net
Master Pages In Asp.netMaster Pages In Asp.net
Master Pages In Asp.net
 
Master page in ASP . NET
Master page in ASP . NETMaster page in ASP . NET
Master page in ASP . NET
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
 
ASP.NET Lecture 3
ASP.NET Lecture 3ASP.NET Lecture 3
ASP.NET Lecture 3
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Formbased authentication in asp.net
Formbased authentication in asp.netFormbased authentication in asp.net
Formbased authentication in asp.net
 
Nevigation control in asp.net
Nevigation control in asp.netNevigation control in asp.net
Nevigation control in asp.net
 
Restoring SharePoint Frontend server
Restoring SharePoint Frontend serverRestoring SharePoint Frontend server
Restoring SharePoint Frontend server
 
Difference between authentication and authorization in asp.net
Difference between authentication and authorization in asp.netDifference between authentication and authorization in asp.net
Difference between authentication and authorization in asp.net
 
Master page in asp.net
Master page in asp.netMaster page in asp.net
Master page in asp.net
 
State management
State managementState management
State management
 
Authentication and Authorization in Asp.Net
Authentication and Authorization in Asp.NetAuthentication and Authorization in Asp.Net
Authentication and Authorization in Asp.Net
 
Toc(df avs nfa)avishek130650107020
Toc(df avs nfa)avishek130650107020Toc(df avs nfa)avishek130650107020
Toc(df avs nfa)avishek130650107020
 
JSP Custom Tags
JSP Custom TagsJSP Custom Tags
JSP Custom Tags
 
WCF
WCFWCF
WCF
 
Presentación softeng agile-eu gimbernat
Presentación softeng  agile-eu gimbernatPresentación softeng  agile-eu gimbernat
Presentación softeng agile-eu gimbernat
 
Windows Presentation Foundation
Windows Presentation Foundation  Windows Presentation Foundation
Windows Presentation Foundation
 
Developing Multi-tenant provider hosted apps: From Idea to Office Store
Developing Multi-tenant provider hosted apps: From Idea to Office StoreDeveloping Multi-tenant provider hosted apps: From Idea to Office Store
Developing Multi-tenant provider hosted apps: From Idea to Office Store
 
EUGM15 - Zoltán Simon (Printnet): Drug Profile Matching - Drug Discovery by P...
EUGM15 - Zoltán Simon (Printnet): Drug Profile Matching - Drug Discovery by P...EUGM15 - Zoltán Simon (Printnet): Drug Profile Matching - Drug Discovery by P...
EUGM15 - Zoltán Simon (Printnet): Drug Profile Matching - Drug Discovery by P...
 

Similar to Master pages

Aspnet master pages_tutorial_10_cs
Aspnet master pages_tutorial_10_csAspnet master pages_tutorial_10_cs
Aspnet master pages_tutorial_10_cs
Vaibhav Chavan
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
Mani Chaubey
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
Niit Care
 
Asp.net web page syntax overview
Asp.net web page syntax overviewAsp.net web page syntax overview
Asp.net web page syntax overview
Salam Khan
 
Master Pages And Navigation
Master Pages And NavigationMaster Pages And Navigation
Master Pages And Navigation
Alfredo Cancino
 
3) web development
3) web development3) web development
3) web development
techbed
 

Similar to Master pages (20)

Master pages
Master pagesMaster pages
Master pages
 
masterpages 1.pptx
masterpages 1.pptxmasterpages 1.pptx
masterpages 1.pptx
 
Master page
Master pageMaster page
Master page
 
ASP.NET 06 - Customizing Your Sites Appearance
ASP.NET 06 - Customizing Your Sites AppearanceASP.NET 06 - Customizing Your Sites Appearance
ASP.NET 06 - Customizing Your Sites Appearance
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
 
Aspnet master pages_tutorial_10_cs
Aspnet master pages_tutorial_10_csAspnet master pages_tutorial_10_cs
Aspnet master pages_tutorial_10_cs
 
Chapter 5 (master page)
Chapter 5 (master page)Chapter 5 (master page)
Chapter 5 (master page)
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
 
Customizing the Appearance and HTML Output of Visualforce Pages
Customizing the Appearance and HTML Output of VisualforcePages Customizing the Appearance and HTML Output of VisualforcePages
Customizing the Appearance and HTML Output of Visualforce Pages
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
 
Intro to OctoberCMS
Intro to OctoberCMSIntro to OctoberCMS
Intro to OctoberCMS
 
Lecture11
Lecture11Lecture11
Lecture11
 
Asp.net web page syntax overview
Asp.net web page syntax overviewAsp.net web page syntax overview
Asp.net web page syntax overview
 
Advanced SharePoint 2013 Site Administration
Advanced SharePoint 2013 Site AdministrationAdvanced SharePoint 2013 Site Administration
Advanced SharePoint 2013 Site Administration
 
Master Pages And Navigation
Master Pages And NavigationMaster Pages And Navigation
Master Pages And Navigation
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
 
3) web development
3) web development3) web development
3) web development
 
Blooming SharePoint Design
Blooming SharePoint DesignBlooming SharePoint Design
Blooming SharePoint Design
 

More from teach4uin (20)

Controls
ControlsControls
Controls
 
validation
validationvalidation
validation
 
validation
validationvalidation
validation
 
.Net framework
.Net framework.Net framework
.Net framework
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
Css1
Css1Css1
Css1
 
Code model
Code modelCode model
Code model
 
Asp db
Asp dbAsp db
Asp db
 
security configuration
security configurationsecurity configuration
security configuration
 
static dynamic html tags
 static dynamic html tags static dynamic html tags
static dynamic html tags
 
static dynamic html tags
static dynamic html tagsstatic dynamic html tags
static dynamic html tags
 
New microsoft office power point presentation
New microsoft office power point presentationNew microsoft office power point presentation
New microsoft office power point presentation
 
.Net overview
.Net overview.Net overview
.Net overview
 
Stdlib functions lesson
Stdlib functions lessonStdlib functions lesson
Stdlib functions lesson
 
enums
enumsenums
enums
 
memory
memorymemory
memory
 
array
arrayarray
array
 
storage clas
storage classtorage clas
storage clas
 
Cprogrammingprogramcontrols
CprogrammingprogramcontrolsCprogrammingprogramcontrols
Cprogrammingprogramcontrols
 
Cprogrammingoperator
CprogrammingoperatorCprogrammingoperator
Cprogrammingoperator
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 

Master pages

  • 2. Master pages Master page defines a combination of fixed content and content place holder to hold the web page(.aspx)
  • 3. Master Page An ASP.NET file with a .master file extension. A master page contains a layout that includes text, HTML, and server controls. Instead of an “@ Page” directive, it contains an “@ Master” directive. The master page contains all top-level HTML elements for a page, including <html>, <head>, and <form>. A master page typically includes the page structure (usually an HTML table), company name and logo, and site navigation. To enable pages to insert content, a master page contains one or more ContentPlaceHolder controls. A master page inherits from the MasterPage class.
  • 4. Content Page A content page defines the ContentPlaceHolder controls in a master page, essentially filling in the blanks. A content page is a standard .aspx file and is bound to the master page using the MasterPageFile attribute in the “@ Page” directive. Master pages provide templates that you can use to create consistent Web pages throughout an application.
  • 5. continued To use master pages, first create a master page and add layout tables and other common elements. Then add ContentPlaceHolder controls to the master page. To create the content pages, add standard Web forms, select the master page check box when creating the page, select the master page, and then add content to the page.
  • 6. Master pages To reference public properties in a master page, add the “@ MasterType” declaration to the content page and reference the property using Master.Property_Name. To reference controls in a master page, call Master.FindControl from the content page.
  • 7.
  • 8. Master pages ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the pages (or a group of pages) in your application. You can then create individual content pages that contain the content you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page.
  • 9. How master page works A master page is an ASP.NET file with the extension .master (for example, MySite.master) with a predefined layout that can include static text, HTML elements, and server controls. The master page is identified by a special @ Master directive that replaces the @ Page directive that is used for ordinary .aspx pages. The directive looks like the following.  <%@ Master Language="C#" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
  • 10. Content page You define the content for the master page's placeholder controls by creating individual content pages, which are ASP.NET pages (.aspx files and, optionally, code-behind files) that are bound to a specific master page. The binding is established in the content page's @ Page directive by including a MasterPageFile attribute that points to the master page to be used. For example, a content page might have the following @ Page directive, which binds it to the Master1.master page. <%@ Page Language="C#" MasterPageFile="~/MasterPages/Master1.master" Title="Content Page"%>
  • 11. Replaceable content placeholder control  These placeholder controls define regions where replaceable content will appear.  <%@ Master Language="C#" %>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML  1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">  <html xmlns="http://www.w3.org/1999/xhtml" >  <head runat="server" >  <title>Master page title</title>  </head>  <body>  <form id="form1" runat="server">  <table>  <tr>  <td><asp:contentplaceholder id="Main" runat="server" /></td>  <td><asp:contentplaceholder id="Footer" runat="server" /></td>  </tr>  </table>  </form>  </body>  </html>
  • 13. Advantages of master pages They allow you to centralize the common functionality of your pages so that you can make updates in just one place. They make it easy to create one set of controls and code and apply the results to a set of pages. For example, you can use controls on the master page to create a menu that applies to all pages. They give you fine-grained control over the layout of the final page by allowing you to control how the placeholder controls are rendered. They provide an object model that allows you to customize the master page from individual content pages.
  • 14. Run time behaviour of the master page At run time, master pages are handled in the following sequence: 1.Users request a page by typing the URL of the content page. 2.When the page is fetched, the @ Page directive is read. If the directive references a master page, the master page is read as well. If this is the first time the pages have been requested, both pages are compiled. 3.The master page with the updated content is merged into the control tree of the content page. 4.The content of individual Content controls is merged into the corresponding ContentPlaceHolder control in the master page. 5.The resulting merged page is rendered to the browser
  • 15. Run time behaviour of the master page
  • 16. Themes and skin files Themes are a feature similar to style sheets as they help to supply a standard look and feel to web controls. You can use CSS style sheets to supply styles to HTML elements but if you wanted to use a set of predefined styling attributes to your web controls then you should use a Theme. 

Editor's Notes

  1. With most web sites, only part of the page changes when you go from one page to another. The parts that don’t change usually include common regions like the header, a menu, and the footer. To create web pages with a consistent layout you need a way to define these relatively static regions in a single template file.
  2. Master pages defines a combination of fixed content and contentPlace holders which are filled by individual web pages.
  3. Themes are contained in a special ASP.NET folder called App_Themes and each Theme you want to add in your web application should reside in a separate folder under this App_Themes folder. Let’s say you want to create a Theme called Dallas for the visitors that are coming from Dallas then you can create a DallasTheme folder under App_Themes folder to represent this Theme. In this folder you need to create a skin file. A skin file a file in which you describe the visual styles that are used by pages that will use this Theme. The name if the skin file is not important but the extension should be .skin. In the skin file you just need to add the exact definitions of the web controls with all the visual attributes you want. You need to add the runat=”server” attribute but beware of adding the ID attribute because that will cause an error. For example I have a skin file with the following contents &amp;lt;asp:TextBox runat=&amp;quot;server&amp;quot; Font-Names=&amp;quot;Verdana&amp;quot; Font-Size=&amp;quot;11px&amp;quot; Width=&amp;quot;200px&amp;quot; BorderStyle=&amp;quot;Solid&amp;quot; BorderColor=&amp;quot;#cc6666&amp;quot; BackColor=&amp;quot;#ffcccc&amp;quot; /&amp;gt; And this file is placed in the App_Themes/DallasTheme folder. Remember that the theme is identified by the theme folder name in this case DallasTheme. After you’ve placed the skin file you need to set a web page to use this Theme. You can enable a Theme for the entire page by setting the Theme attribute of the page equal to the name of the Theme. In this case it would be Now at every place where a Textbox web control is used, it will be rendered with the styles defined in the skin file. If you want to disable the Theme for a specific control you can set its EnableTheming property to false and it won’t get the styles from the skin file and instead you can add your own b specifying attributes. You can also define more than one style for a web control in the skin file by adding the SkinID attribute to the web control definition in the skin file and in the web page that is utilizing the Theme you can set the control’s SkinID equal to the one you want to use from the skin file.