SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Developing Web Applications Using ASP.NET
Objectives


                In this session, you will learn to:
                   Describe the concept of a master page
                   Describe the concept of a content page
                   Describe nested master pages
                   Design master pages
                   Configure content pages
                   Design nested master pages




     Ver. 1.0                                               Slide 1 of 18
Developing Web Applications Using ASP.NET
What Are Master Pages?


                Master pages:
                   Are ASP.NET files similar to ASP.NET Web Forms.
                   Define consistent, reusable layouts, code, and content that is
                   typically used by more than one Web page in a Web
                   application.
                   Have a file extension of .master.
                   Contain the @Master directive.
                   Do not represent complete Web pages. The content and
                   functionality is incorporated with other Web pages on the same
                   Web site at run time.




     Ver. 1.0                                                            Slide 2 of 18
Developing Web Applications Using ASP.NET
What Are Master Pages? (Contd.)


                Advantages of using master pages:
                   Allow centralization of the common functionality of Web pages.
                   Make it easy to create one set of controls and code and apply
                   the results to a set of pages.
                   Provide fine-grained control over the layout of Web pages.
                   Allow customization of master page from the individual content
                   pages.




     Ver. 1.0                                                            Slide 3 of 18
Developing Web Applications Using ASP.NET
What Are Master Pages? (Contd.)


                ASP.NET includes a handler that prevents master pages
                from being served directly to a browser.
                When a Web page references a master page, ASP.NET:
                1. Fetches the requested Web page.
                2. Fetches the master page referenced by the requested Web
                   page.
                3. Merges the content from the master page with that of the
                   requested Web page.
                4. Sends the merged results to the browser.




     Ver. 1.0                                                         Slide 4 of 18
Developing Web Applications Using ASP.NET
What Are Master Pages? (Contd.)


                Designing a Master Page:
                • Master page typically includes one or more
                  ContentPlaceHolder controls identified by their ID
                  attributes.
                • ContentPlaceholder control provides a location where
                  content from referencing pages will be merged at run time.
                • HTML markup, HTML controls, and Web server controls
                  (outside the ContentPlaceHolder control) can also be
                  added to the page.
                • Any server-side code can also be added to the master page.




     Ver. 1.0                                                          Slide 5 of 18
Developing Web Applications Using ASP.NET
What Are Master Pages? (Contd.)


Content Place Holder
Control




         Ver. 1.0                           Slide 6 of 18
Developing Web Applications Using ASP.NET
What Are Content Pages?


                Content Pages:
                • Reference a master page for consistent layout, reusable code,
                  reusable content, and controls.
                • Enable you to create specific content that is included at run
                  time with the generic content from a master page.
                • Reference a master page by including a MasterPageFile
                  attribute in the @Page directive.
                • Contain page-specific content in Content controls. These
                  Content controls are merged at run time with corresponding
                  ContentPlaceholder controls on the referenced master
                  page.




     Ver. 1.0                                                           Slide 7 of 18
Developing Web Applications Using ASP.NET
What Are Content Pages? (Contd.)




  Page-Specific Content




       Ver. 1.0                             Slide 8 of 18
Developing Web Applications Using ASP.NET
Nested Master Pages


                •   When a master page references another master page, the
                    referencing page is known as a child master, and the
                    referenced page is called the parent master.
                •   A child master page references a parent master page by
                    including the MasterPageFile attribute in the @Master
                    directive.
                •   A nested master page can include additional content within
                    its Content controls.
                •   These Content controls correspond to
                    ContentPlaceHolder controls on the parent master.
                •   Child master pages typically contain their own
                    ContentPlaceHolder controls that will be used by
                    content pages.


     Ver. 1.0                                                           Slide 9 of 18
Developing Web Applications Using ASP.NET
How to Create Nested Master Pages


                To create a nested master page, the following three files
                may be created:
                   Parent.master: Acts as a parent master file.
                   Child.master: Acts as a child master file that references the
                   Parent.master page.
                   Child.aspx: Acts as a child file that references the Child.master
                   page .




     Ver. 1.0                                                              Slide 10 of 18
Developing Web Applications Using ASP.NET
How to Create Nested Master Pages (Contd.)


                Parent.master file:
                 <%@ Master Language="C#" %>
                 <HTML>
                    <BODY>
                         ----------Some Tags---------
                         <asp:ContentPlaceHolder ID="MainContent"
                               runat="server“ />
                          ----------Some Tags---------
                 </BODY>
                 </HTML>




     Ver. 1.0                                              Slide 11 of 18
Developing Web Applications Using ASP.NET
How to Create Nested Master Pages (Contd.)


                Child.master file:
                <%@ Master Language="C#“
                MasterPageFile="Parent.master"%>
                   <asp:Content id="Content1“
                   ContentPlaceholderID="MainContent"
                   runat="server">
                --------------Some Tags--------
                       <asp:ContentPlaceHolder ID= "ChildContent"
                       runat="server" />
                --------------Some Tags----------
                   <asp:ContentPlaceHolder ID="ChildFooter“
                   runat="server" />
                           -----------Some Tags------------
                   </asp:Content>


     Ver. 1.0                                              Slide 12 of 18
Developing Web Applications Using ASP.NET
How to Create Nested Master Pages (Contd.)


                Child.aspx file:
                 <%@ Page Language="C#“
                 MasterPageFile="Child.Master"%>
                    <asp:Content id="pageContent"
                    ContentPlaceholderID="ChildContent"
                    runat="server">
                 ----------Some Tags---------
                    </asp:Content>
                    <asp:Content id="footerContent"
                    ContentPlaceholderID="ChildFooter"
                    runat=server>
                 ----------Some Tags---------
                    </asp:Content>




     Ver. 1.0                                             Slide 13 of 18
Developing Web Applications Using ASP.NET
Demo: Creating a Common Layout by Using Master Pages


                Problem Statement:
                   You are a developer in the Adventure Works organization, a
                   fictitious bicycle manufacturer. You have been asked to assist
                   in the development of the Business-to-Consumer (B2C) Web
                   application and a related Business-to-Employee (B2E) extranet
                   portal.
                   Decisions on the design of the application have already been
                   made. You have been asked to carry out a number of specific
                   tasks in order to implement various elements of this design. As
                   part of the first phase of the B2C development, you have been
                   asked to implement a hierarchy of master pages that enable
                   commonly used user interface elements to be defined in one
                   place and then reused in many Web pages throughout the site.




     Ver. 1.0                                                            Slide 14 of 18
Developing Web Applications Using ASP.NET
Demo: Creating a Common Layout by Using Master Pages (Contd.)


                Solution:
                 • You need to perform following tasks:
                    1. Design a Master Page
                        a.   Open the Adventure Works Web site.
                        b.   Create the TopLevel.master page.
                        c.   Define the layout of the TopLevel.master page.
                        d.   Write code for the TopLevel.master page.




     Ver. 1.0                                                                 Slide 15 of 18
Developing Web Applications Using ASP.NET
Demo: Creating a Common Layout by Using Master Pages (Contd.)


                1. Add and Configure Content Pages
                    a. Add a new Contact.aspx Web page.
                    b. Define the layout of the new Contact.aspx Web page.
                    c. Add code to the Contact.aspx page.
                    d. Specify the master page for the existing Default.aspx Web page.
                    e. Programmatically access controls on the master page from the Default.aspx
                       content page.
                    f. Add preconfigured content Web pages to the Adventure Works Web site.




     Ver. 1.0                                                                          Slide 16 of 18
Developing Web Applications Using ASP.NET
Demo: Creating a Common Layout by Using Master Pages (Contd.)


                1. Design Nested Master Pages
                    a.   Add a nested master page.
                    b.   Design the nested master page.
                    c.   Add content pages for the nested master page.
                    d.   Test the Adventure Works Web site.
                    e.   Modify the TopLevel.master page.




     Ver. 1.0                                                            Slide 17 of 18
Developing Web Applications Using ASP.NET
Summary


               In this session, you learned that:
                  Master pages are ASP.NET files with the .master extension.
                  Master pages define consistent, reusable layouts, code and
                  content for multiple Web pages.
                  Master pages are not sent to the browser directly.
                  Master page elements are merged with referencing Web pages
                  at run time.
                  Merged content is sent to the browser.
                  Content pages are Web pages that reference a master page.
                  Content pages include their own page-specific content that is
                  merged with the master page at run time.
                  A master page can reference another master page.




    Ver. 1.0                                                          Slide 18 of 18

Weitere ähnliche Inhalte

Was ist angesagt?

Asp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraAsp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohra
Gajanand Bohra
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17
Niit Care
 
Chapter6 web apps-tomcat
Chapter6 web apps-tomcatChapter6 web apps-tomcat
Chapter6 web apps-tomcat
Venkat Gowda
 
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web PlatformWordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
George Kanellopoulos
 
Wordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The NextwebWordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The Nextweb
George Kanellopoulos
 
Php apache vs iis By Hafedh Yahmadi
Php apache vs iis  By Hafedh YahmadiPhp apache vs iis  By Hafedh Yahmadi
Php apache vs iis By Hafedh Yahmadi
TechdaysTunisia
 

Was ist angesagt? (20)

Asp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohraAsp.net presentation by gajanand bohra
Asp.net presentation by gajanand bohra
 
12 asp.net session17
12 asp.net session1712 asp.net session17
12 asp.net session17
 
Chapter6 web apps-tomcat
Chapter6 web apps-tomcatChapter6 web apps-tomcat
Chapter6 web apps-tomcat
 
Asp net
Asp netAsp net
Asp net
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...
 
Asp.net
Asp.netAsp.net
Asp.net
 
1 app 2 developers 3 servers
1 app 2 developers 3 servers1 app 2 developers 3 servers
1 app 2 developers 3 servers
 
PHP konferencija - Microsoft
PHP konferencija - MicrosoftPHP konferencija - Microsoft
PHP konferencija - Microsoft
 
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web PlatformWordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
Wordcamp Thessaloniki 2011 Wordpress and Microsoft Web Platform
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
 
Wordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The NextwebWordcamp Thessaloniki 2011 The Nextweb
Wordcamp Thessaloniki 2011 The Nextweb
 
WSS And Share Point For Developers
WSS And Share Point For DevelopersWSS And Share Point For Developers
WSS And Share Point For Developers
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
 
Microsoft Tech Ed 2006 #1
Microsoft Tech Ed 2006 #1Microsoft Tech Ed 2006 #1
Microsoft Tech Ed 2006 #1
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
 
Php apache vs iis By Hafedh Yahmadi
Php apache vs iis  By Hafedh YahmadiPhp apache vs iis  By Hafedh Yahmadi
Php apache vs iis By Hafedh Yahmadi
 
Microsoft Tech Ed 2006 #2
Microsoft Tech Ed 2006 #2Microsoft Tech Ed 2006 #2
Microsoft Tech Ed 2006 #2
 
API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...
API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...
API & Custom Widgets coming in XCC next - Web Content and Custom App Extensio...
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Asp.net mvc
Asp.net mvcAsp.net mvc
Asp.net mvc
 

Andere mochten auch

Album web hae ri
Album web hae riAlbum web hae ri
Album web hae ri
herry1998
 
Local-Web-Design-Flyer
Local-Web-Design-FlyerLocal-Web-Design-Flyer
Local-Web-Design-Flyer
Josh Matthews
 
Act. 1.6. presentación
Act. 1.6. presentaciónAct. 1.6. presentación
Act. 1.6. presentación
Luisinhiog
 
20120123moti slideshare
20120123moti slideshare20120123moti slideshare
20120123moti slideshare
kojitakahashi
 
20110820synth_workshop
20110820synth_workshop20110820synth_workshop
20110820synth_workshop
kojitakahashi
 
研究の世界入門B ガイダンス
研究の世界入門B ガイダンス研究の世界入門B ガイダンス
研究の世界入門B ガイダンス
sympo2011
 

Andere mochten auch (20)

Album web hae ri
Album web hae riAlbum web hae ri
Album web hae ri
 
All AId
All AIdAll AId
All AId
 
scan0030
scan0030scan0030
scan0030
 
conceptos básicos de la informática
conceptos básicos de la informáticaconceptos básicos de la informática
conceptos básicos de la informática
 
Efecto de la aplicación de Hormonas PGR en cultivos de plantas ornamentales
Efecto de la aplicación de Hormonas PGR en cultivos de plantas ornamentalesEfecto de la aplicación de Hormonas PGR en cultivos de plantas ornamentales
Efecto de la aplicación de Hormonas PGR en cultivos de plantas ornamentales
 
La musica
La musicaLa musica
La musica
 
MAN-FRI Admòn Estratègica.
MAN-FRI Admòn Estratègica.MAN-FRI Admòn Estratègica.
MAN-FRI Admòn Estratègica.
 
7 maravillas
7 maravillas7 maravillas
7 maravillas
 
Bioshelter story: Bob the Builder
Bioshelter story: Bob the BuilderBioshelter story: Bob the Builder
Bioshelter story: Bob the Builder
 
Local-Web-Design-Flyer
Local-Web-Design-FlyerLocal-Web-Design-Flyer
Local-Web-Design-Flyer
 
Act. 1.6. presentación
Act. 1.6. presentaciónAct. 1.6. presentación
Act. 1.6. presentación
 
20120123moti slideshare
20120123moti slideshare20120123moti slideshare
20120123moti slideshare
 
Introduzione fonti rinnovabili
Introduzione fonti rinnovabiliIntroduzione fonti rinnovabili
Introduzione fonti rinnovabili
 
20110820synth_workshop
20110820synth_workshop20110820synth_workshop
20110820synth_workshop
 
Il lavoro è morto
Il lavoro è mortoIl lavoro è morto
Il lavoro è morto
 
Yuritaa!!
Yuritaa!!Yuritaa!!
Yuritaa!!
 
SAKTHI RE NEW1
SAKTHI RE NEW1SAKTHI RE NEW1
SAKTHI RE NEW1
 
2016-03-01 研究の進め方を改善しよう
2016-03-01 研究の進め方を改善しよう2016-03-01 研究の進め方を改善しよう
2016-03-01 研究の進め方を改善しよう
 
Fundamentos Administrativos
Fundamentos AdministrativosFundamentos Administrativos
Fundamentos Administrativos
 
研究の世界入門B ガイダンス
研究の世界入門B ガイダンス研究の世界入門B ガイダンス
研究の世界入門B ガイダンス
 

Ähnlich wie 04 asp.net session05

04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
Mani Chaubey
 
16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23
Niit Care
 
15 asp.net session22
15 asp.net session2215 asp.net session22
15 asp.net session22
Niit Care
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
sasidhar
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
Iblesoft
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
Mani Chaubey
 
Master Pages And Navigation
Master Pages And NavigationMaster Pages And Navigation
Master Pages And Navigation
Alfredo Cancino
 

Ähnlich wie 04 asp.net session05 (20)

04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
 
04 asp.net session05
04 asp.net session0504 asp.net session05
04 asp.net session05
 
11 asp.net session16
11 asp.net session1611 asp.net session16
11 asp.net session16
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 
16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23
 
Chapter 5 (master page)
Chapter 5 (master page)Chapter 5 (master page)
Chapter 5 (master page)
 
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
 
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
 
15 asp.net session22
15 asp.net session2215 asp.net session22
15 asp.net session22
 
Asp.Net 2.0 Presentation
Asp.Net 2.0 PresentationAsp.Net 2.0 Presentation
Asp.Net 2.0 Presentation
 
Branding & Design Opportunities/Challenges with SharePoint 2013
Branding & Design Opportunities/Challenges with SharePoint 2013Branding & Design Opportunities/Challenges with SharePoint 2013
Branding & Design Opportunities/Challenges with SharePoint 2013
 
Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
 
A comprehensive software infrastructure of .Net
A comprehensive software infrastructure of .Net  A comprehensive software infrastructure of .Net
A comprehensive software infrastructure of .Net
 
16 asp.net session23
16 asp.net session2316 asp.net session23
16 asp.net session23
 
01 asp.net session01
01 asp.net session0101 asp.net session01
01 asp.net session01
 
Master Pages And Navigation
Master Pages And NavigationMaster Pages And Navigation
Master Pages And Navigation
 
Master pages
Master pagesMaster pages
Master pages
 
ASP.NET Lecture 3
ASP.NET Lecture 3ASP.NET Lecture 3
ASP.NET Lecture 3
 
Asp.net w3schools
Asp.net w3schoolsAsp.net w3schools
Asp.net w3schools
 

Mehr von Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

04 asp.net session05

  • 1. Developing Web Applications Using ASP.NET Objectives In this session, you will learn to: Describe the concept of a master page Describe the concept of a content page Describe nested master pages Design master pages Configure content pages Design nested master pages Ver. 1.0 Slide 1 of 18
  • 2. Developing Web Applications Using ASP.NET What Are Master Pages? Master pages: Are ASP.NET files similar to ASP.NET Web Forms. Define consistent, reusable layouts, code, and content that is typically used by more than one Web page in a Web application. Have a file extension of .master. Contain the @Master directive. Do not represent complete Web pages. The content and functionality is incorporated with other Web pages on the same Web site at run time. Ver. 1.0 Slide 2 of 18
  • 3. Developing Web Applications Using ASP.NET What Are Master Pages? (Contd.) Advantages of using master pages: Allow centralization of the common functionality of Web pages. Make it easy to create one set of controls and code and apply the results to a set of pages. Provide fine-grained control over the layout of Web pages. Allow customization of master page from the individual content pages. Ver. 1.0 Slide 3 of 18
  • 4. Developing Web Applications Using ASP.NET What Are Master Pages? (Contd.) ASP.NET includes a handler that prevents master pages from being served directly to a browser. When a Web page references a master page, ASP.NET: 1. Fetches the requested Web page. 2. Fetches the master page referenced by the requested Web page. 3. Merges the content from the master page with that of the requested Web page. 4. Sends the merged results to the browser. Ver. 1.0 Slide 4 of 18
  • 5. Developing Web Applications Using ASP.NET What Are Master Pages? (Contd.) Designing a Master Page: • Master page typically includes one or more ContentPlaceHolder controls identified by their ID attributes. • ContentPlaceholder control provides a location where content from referencing pages will be merged at run time. • HTML markup, HTML controls, and Web server controls (outside the ContentPlaceHolder control) can also be added to the page. • Any server-side code can also be added to the master page. Ver. 1.0 Slide 5 of 18
  • 6. Developing Web Applications Using ASP.NET What Are Master Pages? (Contd.) Content Place Holder Control Ver. 1.0 Slide 6 of 18
  • 7. Developing Web Applications Using ASP.NET What Are Content Pages? Content Pages: • Reference a master page for consistent layout, reusable code, reusable content, and controls. • Enable you to create specific content that is included at run time with the generic content from a master page. • Reference a master page by including a MasterPageFile attribute in the @Page directive. • Contain page-specific content in Content controls. These Content controls are merged at run time with corresponding ContentPlaceholder controls on the referenced master page. Ver. 1.0 Slide 7 of 18
  • 8. Developing Web Applications Using ASP.NET What Are Content Pages? (Contd.) Page-Specific Content Ver. 1.0 Slide 8 of 18
  • 9. Developing Web Applications Using ASP.NET Nested Master Pages • When a master page references another master page, the referencing page is known as a child master, and the referenced page is called the parent master. • A child master page references a parent master page by including the MasterPageFile attribute in the @Master directive. • A nested master page can include additional content within its Content controls. • These Content controls correspond to ContentPlaceHolder controls on the parent master. • Child master pages typically contain their own ContentPlaceHolder controls that will be used by content pages. Ver. 1.0 Slide 9 of 18
  • 10. Developing Web Applications Using ASP.NET How to Create Nested Master Pages To create a nested master page, the following three files may be created: Parent.master: Acts as a parent master file. Child.master: Acts as a child master file that references the Parent.master page. Child.aspx: Acts as a child file that references the Child.master page . Ver. 1.0 Slide 10 of 18
  • 11. Developing Web Applications Using ASP.NET How to Create Nested Master Pages (Contd.) Parent.master file: <%@ Master Language="C#" %> <HTML> <BODY> ----------Some Tags--------- <asp:ContentPlaceHolder ID="MainContent" runat="server“ /> ----------Some Tags--------- </BODY> </HTML> Ver. 1.0 Slide 11 of 18
  • 12. Developing Web Applications Using ASP.NET How to Create Nested Master Pages (Contd.) Child.master file: <%@ Master Language="C#“ MasterPageFile="Parent.master"%> <asp:Content id="Content1“ ContentPlaceholderID="MainContent" runat="server"> --------------Some Tags-------- <asp:ContentPlaceHolder ID= "ChildContent" runat="server" /> --------------Some Tags---------- <asp:ContentPlaceHolder ID="ChildFooter“ runat="server" /> -----------Some Tags------------ </asp:Content> Ver. 1.0 Slide 12 of 18
  • 13. Developing Web Applications Using ASP.NET How to Create Nested Master Pages (Contd.) Child.aspx file: <%@ Page Language="C#“ MasterPageFile="Child.Master"%> <asp:Content id="pageContent" ContentPlaceholderID="ChildContent" runat="server"> ----------Some Tags--------- </asp:Content> <asp:Content id="footerContent" ContentPlaceholderID="ChildFooter" runat=server> ----------Some Tags--------- </asp:Content> Ver. 1.0 Slide 13 of 18
  • 14. Developing Web Applications Using ASP.NET Demo: Creating a Common Layout by Using Master Pages Problem Statement: You are a developer in the Adventure Works organization, a fictitious bicycle manufacturer. You have been asked to assist in the development of the Business-to-Consumer (B2C) Web application and a related Business-to-Employee (B2E) extranet portal. Decisions on the design of the application have already been made. You have been asked to carry out a number of specific tasks in order to implement various elements of this design. As part of the first phase of the B2C development, you have been asked to implement a hierarchy of master pages that enable commonly used user interface elements to be defined in one place and then reused in many Web pages throughout the site. Ver. 1.0 Slide 14 of 18
  • 15. Developing Web Applications Using ASP.NET Demo: Creating a Common Layout by Using Master Pages (Contd.) Solution: • You need to perform following tasks: 1. Design a Master Page a. Open the Adventure Works Web site. b. Create the TopLevel.master page. c. Define the layout of the TopLevel.master page. d. Write code for the TopLevel.master page. Ver. 1.0 Slide 15 of 18
  • 16. Developing Web Applications Using ASP.NET Demo: Creating a Common Layout by Using Master Pages (Contd.) 1. Add and Configure Content Pages a. Add a new Contact.aspx Web page. b. Define the layout of the new Contact.aspx Web page. c. Add code to the Contact.aspx page. d. Specify the master page for the existing Default.aspx Web page. e. Programmatically access controls on the master page from the Default.aspx content page. f. Add preconfigured content Web pages to the Adventure Works Web site. Ver. 1.0 Slide 16 of 18
  • 17. Developing Web Applications Using ASP.NET Demo: Creating a Common Layout by Using Master Pages (Contd.) 1. Design Nested Master Pages a. Add a nested master page. b. Design the nested master page. c. Add content pages for the nested master page. d. Test the Adventure Works Web site. e. Modify the TopLevel.master page. Ver. 1.0 Slide 17 of 18
  • 18. Developing Web Applications Using ASP.NET Summary In this session, you learned that: Master pages are ASP.NET files with the .master extension. Master pages define consistent, reusable layouts, code and content for multiple Web pages. Master pages are not sent to the browser directly. Master page elements are merged with referencing Web pages at run time. Merged content is sent to the browser. Content pages are Web pages that reference a master page. Content pages include their own page-specific content that is merged with the master page at run time. A master page can reference another master page. Ver. 1.0 Slide 18 of 18

Hinweis der Redaktion

  1. Provide the example code of @Master directive, Explain how layout, code and content can be reused. Also tell the alternate activity used for the same purpose
  2. Discuss the advantages with examale
  3. Explain the sequence, Define the role of ContentPlaceHoder with an example
  4. Explain @page directive with example, explain the relationship between Content control and ContentPlaceholder Control
  5. Explain @page directive with example, explain the relationship between Content control and ContentPlaceholder Control
  6. Explain @page directive with example, explain the relationship between Content control and ContentPlaceholder Control
  7. Explain @page directive with example, explain the relationship between Content control and ContentPlaceholder Control
  8. Explain with the example given in CG