SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Training on Master pages Introducing Master pages byPRAVEEN NANDAGIRI
Agenda Master Pages Menu, Tree View Controls Themes and Skins Training on Master pages
Training on Master pages Master Page Content Page
     On the left is a master page as seen in the Visual Studio 2005 IDE. On the right is a content page that uses that master page, also shown in Visual Studio. Note the rich design-time exeprience: when the content page is open in the designer, content declared in the page itself is shown in full color, while content inherited from the master page is shown in half-color. Master pages enable developers to build templates that contribute code and content to other pages ("content pages") on the site. Because ASP.NET 1.x lacked template support, developers often resorted to factoring common UI elements--elements that appear on multiple pages--into user controls and then declaring the user controls in each page that uses them. Master pages provide a more elegant solution to the problem of defining common look and feel. The term "visual inheritance" is often used to describe master pages because content pages inherit appearance from master pages the same way derived classes inherit methods, properties, and other type members from base classes. Training on Master pages
Training on Master pages Masters define common content and placeholders (<asp:ContentPlaceHolder>) Content pages reference masters and fill placeholders with content (<asp:Content>) Site.master default.aspx http://.../default.aspx <%@ Master %> <asp:ContentPlaceHolder   ID="Main"   RunAt="server" /> <%@ Page MasterPage-   File="Site.master" %> <asp:Content   ContentPlaceHolderID=   "Main" RunAt="server" /> </asp:Content>
    The first and most important concept to grasp when learning about master pages is that of Content and ContentPlaceHolder controls. Master pages use ContentPlaceHolder controls to define where content pages can plug in content. Content pages plug in content by declaring Content controls whose ContentPlaceHolderID properties match ContentPlaceHolder IDs in the master. A master page can contain an unlimited number of ContentPlaceHolder controls. All content defined in content pages MUST appear in Content controls--that is, between <asp:Content> and </asp:Content> tags. Training on Master pages
Master file “A.master” Content file “B.aspx” . . < % @  Page  < % @  Master  % > Master = ”A . master” % > < asp : Content  runat = server  ContentName = ”Main” > < / asp : Content > < asp : Content  < asp : ContentPlaceHolder  runat = server  runat = server  ContentName = ”Footer” > ContentName = ”Main”  / > < / asp : Content > < asp : ContentPlaceHolder  runat = server  ContentName = ”Footer”  / > Resulting Page Training on Master pages
Training on Master pages This slide shows how to add a new item to a web site (here we add a master page)
Training on Master pages This slide shows how to  give a name to a master page
Training on Master pages This slide shows  that once you add  a master page to a website  how  it looks (This is the sourse of master page)
Training on Master pages This slide shows  that how to give a content placeholder to a master page
Training on Master pages This slide shows  that  design of the master page  and it contains content place holder
Defining a Master Page <%@ Master Language="VB" %> <html>   <body>     <!-- Banner shown on all pages that use this master --> <table width="100%">       <tr>         <td bgcolor="darkblue" align="center">           <span style="font-size: 36pt; color: white">ACME Inc.</span>         </td>       </tr>     </table>     <!-- Placeholder for content below banner -->     <asp:ContentPlaceHolder ID="Main" RunAt="server" />   </body> </html>
Master Pages: Creating a master page 1. Create a master page with .master extension 2. Define a master directive: <%@ master .. %> 3. Add content: Can contain any html or control page content Define replaceable place-holder regions: Use an <asp:contentplaceholder> control Add default content within it (optional)
Modified Master Page <%@ Master Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">     <title>Untitled Page</title> </head> <body>     <form id="form1" runat="server">     <div>         &nbsp;<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">             <tr>                 <td colspan="2" style="height: 100px">                     <img src="images/asp_net_logo.gif" />                     &nbsp; &nbsp; <span style="font-size: 24pt">Minder Chen ASP.NET Learning Web Site</span></td>             </tr>             <tr>                 <td style="width: 49px" valign="top">                      <asp:Menu ID="Menu1" runat="server">                     </asp:Menu>                 </td>                 <td> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">                     </asp:ContentPlaceHolder>                 </td>             </tr>         </table>     </div>     </form></body></html>
Default Content ContentPlaceHolder controls can define content of their own ("default content") Default content is displayed ONLY if not overridden by content page <%@ Master %>   ... <asp:ContentPlaceHolder ID="Main" RunAt="server">   This is default content that will appear in the absence of a   matching Content control in a content page <asp:ContentPlaceHolder>
Add a Content Page based on a Master Page
Create a Content Page: Applying a Master Page <%@ Page MasterPageFile="~/MasterPage.master" %> <asp:Content ContentPlaceHolderID="Main" RunAt="server">   This content fills the content place holder "Main" defined in the master page (site.Master) </asp:Content>
Using a Master Page 1. Create an ASP.NET page (.aspx extension) 2. On the page directive: <%@ page masterpagefile= %> attribute to reference master Set the title attribute <%@ Page title=“jeff” %> 3. Optionally add content to override the master: a.  Only <asp:content> controls or server-side script allowed b. <asp:content> controls replace regions in the master: The contentplaceholderid identifies master’s region <asp:content> controls can contain any page content
A Content Page with a Master Page Applied
Code for AboutUS.aspx <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="A  bout US" %> <asp:Content ID="Content1"  ContentPlaceHolderID="ContentPlaceHolder1"  Runat="Server">     <strong><span style="font-size: 14pt">This is a web site developed  by Minder Chen tohelp others to learn ASp.NET 1.X and 2.0.          <br />         He has used ASP.NET for more than 3 years by now and has  developed a Web-based DecisionSupport System using ASP.NET. He can be reached at minderchen@hotmail.com         <br />     </span></strong> </asp:Content>
Applying a Master Page to a Site <configuration>   <system.web>     <pages masterPageFile="~/MasterPage.master" />   </system.web> </configuration>
The Page.Master Property Retrieves reference to master page Instance of class derived from System.Web.UI.MasterPage Null if page doesn't have a master Used to programmatically access content defined in the master page Use FindControl for weak typing Use public property in master page for strong typing (preferred)
Menu 200+ Properties; here are the top 4: Orientation = Horizontal StaticDisplayLevels = 2 StaticSubMenuIndent = 0 DisappearAfter = 300
Menu Control Tag  <asp:Menu ID="Menu1" runat="server" BackColor="#B5C7DE" DataSourceID="SiteMapDataSource1" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284E98" Orientation="Horizontal" StaticSubMenuIndent="10px">          <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />          <DynamicHoverStyle BackColor="#284E98" ForeColor="White" BorderStyle="Groove" />          <DynamicMenuStyle BackColor="#B5C7DE" />          <StaticSelectedStyle BackColor="#507CD1" /> <DynamicSelectedStyle BackColor="#507CD1" />          <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />          <StaticHoverStyle BackColor="#284E98" ForeColor="White" /> </asp:Menu>
Menu  or Tree: Choosing the right control
Theme and Skin
Add a Style Sheet in a Theme
Style Builder – Build Style Rule H1 {     font-size: 30px;     color: yellow;     font-style: italic;     font-family: 'Comic Sans MS';     background-color: blue;     font-variant: small-caps; }
Apply Themes to the Web Site <configuration>     <system.web>         <pages theme="ThemeName" />     </system.web> </configuration>
To apply a theme to an individual page <%@ Page Theme="ThemeName" %> <%@ Page StyleSheetTheme="ThemeName" %>
Themes: Architecture     Themes are made up of a set of elements: skins, cascading style sheets (CSS), images, and other resources. At a minimum, a theme will contain skins. Themes are defined in special directories in your Web site or on your Web server. Basically: Inserts a link to your CSS Style Sheet Updates properties on your controls Two groups of files: Your site – Nothing here changes Theme A – Style Sheets, Images, Skins At runtime these files are associated
Themes: Recommended usage Do as much as you can inside the Style Sheet Foreground Images can’t be controlled by CSS, so use Skins Advanced controls, use Skins
Skin
SkinFile.skin <%--Default skin template. The following skins are provided as examples only. 1. Named control skin. The SkinId should be uniquely defined because    duplicate SkinId's per control type are not allowed in the same theme. <asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" >    <AlternatingRowStyle BackColor="Blue" /> </asp:GridView> 2. Default skin. The SkinId is not defined. Only one default     control skin per control type is allowed in the same theme. <asp:Image runat="server" ImageUrl="~/images/image1.jpg" /> --%> <asp:Button runat="server"    BackColor="Red"    ForeColor="White"    Font-Name="Arial"    Font-Size="9px" SkinID="Red" />   <asp:Button runat="server"    BackColor="Blue"   ForeColor="Yellow"    Font-Name="Arial"    Font-Size="14px"  />
Sample Code  You need to use Theme in order to use Skin <%@ Page Language="VB" Theme="Theme1"  MasterPageFile="~/MasterPage.master" Title="Untitled Page" %> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) End Sub </script> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">     <h1>Contact Information</h1>     Email:      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>      <asp:Button ID="Button1" SkinID="Red"  runat="server"    Text="Submit" />     <asp:Button ID="Button2" runat="server" Text="Reset" /> </asp:Content>
Thank You !

Weitere ähnliche Inhalte

Was ist angesagt?

Html5 structure & semantic
Html5 structure & semanticHtml5 structure & semantic
Html5 structure & semantic
Muktadiur Rahman
 

Was ist angesagt? (20)

Master page
Master pageMaster page
Master page
 
Themes
ThemesThemes
Themes
 
Master page
Master pageMaster page
Master page
 
HYF - Class 01 - HTML And CSS
HYF - Class 01 - HTML And CSSHYF - Class 01 - HTML And CSS
HYF - Class 01 - HTML And CSS
 
Anchors!
Anchors!Anchors!
Anchors!
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Web development
Web developmentWeb development
Web development
 
Chapter 5 (master page)
Chapter 5 (master page)Chapter 5 (master page)
Chapter 5 (master page)
 
Html5 semantics
Html5 semanticsHtml5 semantics
Html5 semantics
 
Developing Branding Solutions for 2013
Developing Branding Solutions for 2013Developing Branding Solutions for 2013
Developing Branding Solutions for 2013
 
SharePoint 2010 Pages
SharePoint 2010 Pages SharePoint 2010 Pages
SharePoint 2010 Pages
 
HTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchorsHTML5 - create hyperlinks and anchors
HTML5 - create hyperlinks and anchors
 
Content query web part – get it all in one place and style it!
Content query web part – get it all in one place and style it!Content query web part – get it all in one place and style it!
Content query web part – get it all in one place and style it!
 
Html5 semantics
Html5 semanticsHtml5 semantics
Html5 semantics
 
Html2
Html2Html2
Html2
 
Tf fcchc
Tf fcchcTf fcchc
Tf fcchc
 
Ffcchtml
FfcchtmlFfcchtml
Ffcchtml
 
Technical seo tips for web developers
Technical seo tips for web developersTechnical seo tips for web developers
Technical seo tips for web developers
 
UX01 Customization Tour Of SharePoint - APAC Conference Sydney - 2007
UX01 Customization Tour Of SharePoint - APAC Conference Sydney - 2007UX01 Customization Tour Of SharePoint - APAC Conference Sydney - 2007
UX01 Customization Tour Of SharePoint - APAC Conference Sydney - 2007
 
Html5 structure & semantic
Html5 structure & semanticHtml5 structure & semantic
Html5 structure & semantic
 

Andere mochten auch

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
 
State management
State managementState management
State management
Iblesoft
 

Andere mochten auch (20)

Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
 
Controls in asp.net
Controls in asp.netControls in asp.net
Controls in asp.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
 
ASP.net Image Slideshow
ASP.net Image SlideshowASP.net Image Slideshow
ASP.net Image Slideshow
 
Simple Data Binding
Simple Data BindingSimple Data Binding
Simple Data Binding
 
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
 
Windows Presentation Foundation
Windows Presentation Foundation  Windows Presentation Foundation
Windows Presentation Foundation
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 
Gcm tutorial
Gcm tutorialGcm tutorial
Gcm tutorial
 
State management
State managementState management
State management
 
ASP.NET Page Life Cycle
ASP.NET Page Life CycleASP.NET Page Life Cycle
ASP.NET Page Life Cycle
 
ASP.NET State management
ASP.NET State managementASP.NET State management
ASP.NET State management
 
Jsp Introduction Tutorial
Jsp Introduction TutorialJsp Introduction Tutorial
Jsp Introduction Tutorial
 

Ähnlich wie Master pages ppt

Aspnet2 Overview
Aspnet2 OverviewAspnet2 Overview
Aspnet2 Overview
ajitbergi
 
Meta tags1
Meta tags1Meta tags1
Meta tags1
hapy
 
Xhtml Part1
Xhtml Part1Xhtml Part1
Xhtml Part1
nleesite
 
Meta tags
Meta tagsMeta tags
Meta tags
hapy
 
Meta tags
Meta tagsMeta tags
Meta tags
hapy
 
Advanced SEO for Web Developers
Advanced SEO for Web DevelopersAdvanced SEO for Web Developers
Advanced SEO for Web Developers
Nathan Buggia
 
SES Toronto 2008; Joe Dolson
SES Toronto 2008; Joe DolsonSES Toronto 2008; Joe Dolson
SES Toronto 2008; Joe Dolson
Joseph Dolson
 
What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from Austin
Lisa Adkins
 

Ähnlich wie Master pages ppt (20)

Aspnet2 Overview
Aspnet2 OverviewAspnet2 Overview
Aspnet2 Overview
 
Meta tags1
Meta tags1Meta tags1
Meta tags1
 
merb.intro
merb.intromerb.intro
merb.intro
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
 
Xhtml Part1
Xhtml Part1Xhtml Part1
Xhtml Part1
 
Meta tags
Meta tagsMeta tags
Meta tags
 
Meta tags
Meta tagsMeta tags
Meta tags
 
Html in a box
Html in a boxHtml in a box
Html in a box
 
2310 b 04
2310 b 042310 b 04
2310 b 04
 
Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)
 
Vb.Net Web Forms
Vb.Net  Web FormsVb.Net  Web Forms
Vb.Net Web Forms
 
Cheat codes
Cheat codesCheat codes
Cheat codes
 
Creating a Webpage
Creating a WebpageCreating a Webpage
Creating a Webpage
 
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7
 
How To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My WebHow To Create Personal Web Pages On My Web
How To Create Personal Web Pages On My Web
 
Advanced SEO for Web Developers
Advanced SEO for Web DevelopersAdvanced SEO for Web Developers
Advanced SEO for Web Developers
 
Getting More Traffic From Search Advanced Seo For Developers Presentation
Getting More Traffic From Search  Advanced Seo For Developers PresentationGetting More Traffic From Search  Advanced Seo For Developers Presentation
Getting More Traffic From Search Advanced Seo For Developers Presentation
 
Widgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Widgets: Making Your Site Great and Letting Others Help - WordCamp VictoriaWidgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
Widgets: Making Your Site Great and Letting Others Help - WordCamp Victoria
 
SES Toronto 2008; Joe Dolson
SES Toronto 2008; Joe DolsonSES Toronto 2008; Joe Dolson
SES Toronto 2008; Joe Dolson
 
What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from Austin
 

Mehr von Iblesoft

Ms sql server ii
Ms sql server  iiMs sql server  ii
Ms sql server ii
Iblesoft
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1
Iblesoft
 
State management
State managementState management
State management
Iblesoft
 
Validation controls ppt
Validation controls pptValidation controls ppt
Validation controls ppt
Iblesoft
 
Generics n delegates
Generics n delegatesGenerics n delegates
Generics n delegates
Iblesoft
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
Iblesoft
 
Microsoft.net architecturte
Microsoft.net architecturteMicrosoft.net architecturte
Microsoft.net architecturte
Iblesoft
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
Iblesoft
 
Delegates and events
Delegates and eventsDelegates and events
Delegates and events
Iblesoft
 
Exception handling
Exception handlingException handling
Exception handling
Iblesoft
 

Mehr von Iblesoft (16)

Ms sql server ii
Ms sql server  iiMs sql server  ii
Ms sql server ii
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1
 
State management
State managementState management
State management
 
Validation controls ppt
Validation controls pptValidation controls ppt
Validation controls ppt
 
Controls
ControlsControls
Controls
 
Ado.net
Ado.netAdo.net
Ado.net
 
Generics n delegates
Generics n delegatesGenerics n delegates
Generics n delegates
 
Ajaxppt
AjaxpptAjaxppt
Ajaxppt
 
Data controls ppt
Data controls pptData controls ppt
Data controls ppt
 
Microsoft.net architecturte
Microsoft.net architecturteMicrosoft.net architecturte
Microsoft.net architecturte
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
 
Generics
GenericsGenerics
Generics
 
Delegates and events
Delegates and eventsDelegates and events
Delegates and events
 
Javascript
JavascriptJavascript
Javascript
 
Html ppt
Html pptHtml ppt
Html ppt
 
Exception handling
Exception handlingException handling
Exception handling
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Kürzlich hochgeladen (20)

Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
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
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 

Master pages ppt

  • 1. Training on Master pages Introducing Master pages byPRAVEEN NANDAGIRI
  • 2. Agenda Master Pages Menu, Tree View Controls Themes and Skins Training on Master pages
  • 3. Training on Master pages Master Page Content Page
  • 4. On the left is a master page as seen in the Visual Studio 2005 IDE. On the right is a content page that uses that master page, also shown in Visual Studio. Note the rich design-time exeprience: when the content page is open in the designer, content declared in the page itself is shown in full color, while content inherited from the master page is shown in half-color. Master pages enable developers to build templates that contribute code and content to other pages ("content pages") on the site. Because ASP.NET 1.x lacked template support, developers often resorted to factoring common UI elements--elements that appear on multiple pages--into user controls and then declaring the user controls in each page that uses them. Master pages provide a more elegant solution to the problem of defining common look and feel. The term "visual inheritance" is often used to describe master pages because content pages inherit appearance from master pages the same way derived classes inherit methods, properties, and other type members from base classes. Training on Master pages
  • 5. Training on Master pages Masters define common content and placeholders (<asp:ContentPlaceHolder>) Content pages reference masters and fill placeholders with content (<asp:Content>) Site.master default.aspx http://.../default.aspx <%@ Master %> <asp:ContentPlaceHolder ID="Main" RunAt="server" /> <%@ Page MasterPage- File="Site.master" %> <asp:Content ContentPlaceHolderID= "Main" RunAt="server" /> </asp:Content>
  • 6. The first and most important concept to grasp when learning about master pages is that of Content and ContentPlaceHolder controls. Master pages use ContentPlaceHolder controls to define where content pages can plug in content. Content pages plug in content by declaring Content controls whose ContentPlaceHolderID properties match ContentPlaceHolder IDs in the master. A master page can contain an unlimited number of ContentPlaceHolder controls. All content defined in content pages MUST appear in Content controls--that is, between <asp:Content> and </asp:Content> tags. Training on Master pages
  • 7. Master file “A.master” Content file “B.aspx” . . < % @ Page < % @ Master % > Master = ”A . master” % > < asp : Content runat = server ContentName = ”Main” > < / asp : Content > < asp : Content < asp : ContentPlaceHolder runat = server runat = server ContentName = ”Footer” > ContentName = ”Main” / > < / asp : Content > < asp : ContentPlaceHolder runat = server ContentName = ”Footer” / > Resulting Page Training on Master pages
  • 8. Training on Master pages This slide shows how to add a new item to a web site (here we add a master page)
  • 9. Training on Master pages This slide shows how to give a name to a master page
  • 10. Training on Master pages This slide shows that once you add a master page to a website how it looks (This is the sourse of master page)
  • 11. Training on Master pages This slide shows that how to give a content placeholder to a master page
  • 12. Training on Master pages This slide shows that design of the master page and it contains content place holder
  • 13. Defining a Master Page <%@ Master Language="VB" %> <html> <body> <!-- Banner shown on all pages that use this master --> <table width="100%"> <tr> <td bgcolor="darkblue" align="center"> <span style="font-size: 36pt; color: white">ACME Inc.</span> </td> </tr> </table> <!-- Placeholder for content below banner --> <asp:ContentPlaceHolder ID="Main" RunAt="server" /> </body> </html>
  • 14. Master Pages: Creating a master page 1. Create a master page with .master extension 2. Define a master directive: <%@ master .. %> 3. Add content: Can contain any html or control page content Define replaceable place-holder regions: Use an <asp:contentplaceholder> control Add default content within it (optional)
  • 15. Modified Master Page <%@ Master Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> &nbsp;<table border="0" cellpadding="0" cellspacing="0" style="width: 100%"> <tr> <td colspan="2" style="height: 100px"> <img src="images/asp_net_logo.gif" /> &nbsp; &nbsp; <span style="font-size: 24pt">Minder Chen ASP.NET Learning Web Site</span></td> </tr> <tr> <td style="width: 49px" valign="top"> <asp:Menu ID="Menu1" runat="server"> </asp:Menu> </td> <td> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </td> </tr> </table> </div> </form></body></html>
  • 16. Default Content ContentPlaceHolder controls can define content of their own ("default content") Default content is displayed ONLY if not overridden by content page <%@ Master %> ... <asp:ContentPlaceHolder ID="Main" RunAt="server"> This is default content that will appear in the absence of a matching Content control in a content page <asp:ContentPlaceHolder>
  • 17. Add a Content Page based on a Master Page
  • 18. Create a Content Page: Applying a Master Page <%@ Page MasterPageFile="~/MasterPage.master" %> <asp:Content ContentPlaceHolderID="Main" RunAt="server"> This content fills the content place holder "Main" defined in the master page (site.Master) </asp:Content>
  • 19. Using a Master Page 1. Create an ASP.NET page (.aspx extension) 2. On the page directive: <%@ page masterpagefile= %> attribute to reference master Set the title attribute <%@ Page title=“jeff” %> 3. Optionally add content to override the master: a. Only <asp:content> controls or server-side script allowed b. <asp:content> controls replace regions in the master: The contentplaceholderid identifies master’s region <asp:content> controls can contain any page content
  • 20. A Content Page with a Master Page Applied
  • 21. Code for AboutUS.aspx <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="A bout US" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <strong><span style="font-size: 14pt">This is a web site developed by Minder Chen tohelp others to learn ASp.NET 1.X and 2.0. <br /> He has used ASP.NET for more than 3 years by now and has developed a Web-based DecisionSupport System using ASP.NET. He can be reached at minderchen@hotmail.com <br /> </span></strong> </asp:Content>
  • 22. Applying a Master Page to a Site <configuration> <system.web> <pages masterPageFile="~/MasterPage.master" /> </system.web> </configuration>
  • 23. The Page.Master Property Retrieves reference to master page Instance of class derived from System.Web.UI.MasterPage Null if page doesn't have a master Used to programmatically access content defined in the master page Use FindControl for weak typing Use public property in master page for strong typing (preferred)
  • 24. Menu 200+ Properties; here are the top 4: Orientation = Horizontal StaticDisplayLevels = 2 StaticSubMenuIndent = 0 DisappearAfter = 300
  • 25. Menu Control Tag <asp:Menu ID="Menu1" runat="server" BackColor="#B5C7DE" DataSourceID="SiteMapDataSource1" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284E98" Orientation="Horizontal" StaticSubMenuIndent="10px"> <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" /> <DynamicHoverStyle BackColor="#284E98" ForeColor="White" BorderStyle="Groove" /> <DynamicMenuStyle BackColor="#B5C7DE" /> <StaticSelectedStyle BackColor="#507CD1" /> <DynamicSelectedStyle BackColor="#507CD1" /> <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" /> <StaticHoverStyle BackColor="#284E98" ForeColor="White" /> </asp:Menu>
  • 26. Menu or Tree: Choosing the right control
  • 28. Add a Style Sheet in a Theme
  • 29.
  • 30.
  • 31. Style Builder – Build Style Rule H1 { font-size: 30px; color: yellow; font-style: italic; font-family: 'Comic Sans MS'; background-color: blue; font-variant: small-caps; }
  • 32.
  • 33. Apply Themes to the Web Site <configuration> <system.web> <pages theme="ThemeName" /> </system.web> </configuration>
  • 34. To apply a theme to an individual page <%@ Page Theme="ThemeName" %> <%@ Page StyleSheetTheme="ThemeName" %>
  • 35. Themes: Architecture Themes are made up of a set of elements: skins, cascading style sheets (CSS), images, and other resources. At a minimum, a theme will contain skins. Themes are defined in special directories in your Web site or on your Web server. Basically: Inserts a link to your CSS Style Sheet Updates properties on your controls Two groups of files: Your site – Nothing here changes Theme A – Style Sheets, Images, Skins At runtime these files are associated
  • 36. Themes: Recommended usage Do as much as you can inside the Style Sheet Foreground Images can’t be controlled by CSS, so use Skins Advanced controls, use Skins
  • 37. Skin
  • 38. SkinFile.skin <%--Default skin template. The following skins are provided as examples only. 1. Named control skin. The SkinId should be uniquely defined because duplicate SkinId's per control type are not allowed in the same theme. <asp:GridView runat="server" SkinId="gridviewSkin" BackColor="White" > <AlternatingRowStyle BackColor="Blue" /> </asp:GridView> 2. Default skin. The SkinId is not defined. Only one default control skin per control type is allowed in the same theme. <asp:Image runat="server" ImageUrl="~/images/image1.jpg" /> --%> <asp:Button runat="server" BackColor="Red" ForeColor="White" Font-Name="Arial" Font-Size="9px" SkinID="Red" /> <asp:Button runat="server" BackColor="Blue" ForeColor="Yellow" Font-Name="Arial" Font-Size="14px" />
  • 39.
  • 40. Sample Code You need to use Theme in order to use Skin <%@ Page Language="VB" Theme="Theme1" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) End Sub </script> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <h1>Contact Information</h1> Email: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" SkinID="Red" runat="server" Text="Submit" /> <asp:Button ID="Button2" runat="server" Text="Reset" /> </asp:Content>