Using ASP.NET Master Pages

Slides:



Advertisements
Similar presentations
Master Pages, User Controls, Site Maps, Localization Svetlin Nakov Telerik Corporation
Advertisements

1 eVenzia Technologies Learning HTML, XHTML & CSS Chapter 1.
Asp.NET Page Composition. Slide 2 Lecture Overview Work with master pages and content pages.
IMAGES Controlling size of images in CSS Aligning images in CSS Adding background images.
Course Content, Evaluation, Exams Telerik Software Academy ASP.NET Web Forms.
Ch6:creating consistent looking web sites. Master pages Master page defines a combination of fixed content and content place holder to hold the web page(.aspx)
Lesson 4: Using HTML5 Markup.  The distinguishing characteristics of HTML5 syntax  The new HTML5 sectioning elements  Adding support for HTML5 elements.
AngularJS Routing Routes, Route Parameters, Templates, Location, Navigation SoftUni Team Technical Trainers Software University
Fundamentals SoftUni Welcome to Software University SoftUni Team Technical Trainers Software University
Course Program, Evaluation, Examination Telerik Software Academy Apps for Windows Phone & Windows Store.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Svetlin Nakov Technical Trainer Software University
JS Frameworks Course Program, Evaluation, Exams Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
Unleash the Power of jQuery Doncho Minkov Telerik Software Academy academy.telerik.com Senior Technical Trainer
Things like Textboxes, Lables, ‘n’at. ASPX page is not HTML Controls are rendered into markup that a browser can understand Some controls are rendered.
INFO 330 Wireframes and Templating. How to analyze a Web site Sites have Site-level layout and look Pages. Pages have – Page-level layout look – Page.
Louisa Lambregts, Louisa Lambregts
AMD and RequireJS Splitting JavaScript Code into Dependent Modules Software University Technical Trainers SoftUni Team.
CSE 409 – Advanced Internet Technology Today you will learn  Styles  Themes  Master Pages Themes and Master Pages.
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
Jekyll Static Site Generator Template-Based Site Generation Svetlin Nakov Technical Trainer Software University
ASP.NET MVC Course Program, Evaluation, Exams Nikolay Kostov Telerik Software Academy academy.telerik.com Team Lead, Senior Developer and Trainer
JS Course Program, Evaluation, Exams, Resources Telerik Software Academy JavaScript Fundamentals.
Responsive Design Design that Adapts to Different Devices SoftUni Team Technical Trainers Software University
Meeting #4 – February 2011 – Web-Technologies Homework Assignments Svetlin Nakov Telerik Corporation
Tables, Rows, Columns, Cells, Header, Footer, Colspan, Rowspan
Bootstrap Front-End Framework for Responsive Web Sites Svetlin Nakov Technical Trainer Software University
11 User Controls Beginning ASP.NET in C# and VB Chapter 8.
S'n'D Course Program, Evaluation, Exams, Resources Doncho Minkov Telerik Software Academy academy.telerik.com Technical Trainer
Course Program, Evaluation, Exams, Resources Svetlin Nakov Telerik Software Academy academy.telerik.com Technical Trainer
INTRODUCTION ABOUT DIV Most websites have put their content in multiple columns. Multiple columns are created by using or elements. The div element is.
JS Course Program, Evaluation, Exams, Resources Doncho Minkov Telerik Software Academy academy.telerik.com Technical Trainer
Creating Consistent Looking Websites
HTML5 Semantic
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
Kendo UI ASP.NET MVC Wrappers
Jim Fawcett CSE686 – Internet Programming Summer 2010
JS Frameworks Course Program, Evaluation, Exams
Site Maps and Navigation
Classes, Properties, Constructors, Objects, Namespaces
Working with ASP.NET Master Pages.
Windows System Administration
ASP.NET AJAX – Basics Svetlin Nakov Telerik Corporation
Google APIs and Facebook API
Repeating Code Multiple Times
JavaScript OOP: Course Introduction
Front-End Framework for Responsive Web Sites
Functional Programming
JavaScript Applications: Course Introduction
ASP.NET Razor Engine SoftUni Team ASP.NET MVC Introduction
Web Design and Development
Kendo UI ASP.NET MVC Wrappers
JavaScript Applications: Course Introduction
Web Service Testing …in another way Software Quality Assurance
Web Fundamentals (HTML and CSS)
Extending functionality using Collections
Functional Programming
Exporting and Importing Data
CSS Transitions and Animations
Binary, Decimal and Hexadecimal Numbers
Software Quality Assurance
File Upload in ASP.NET Ivaylo Kenov Technical Assistant
CSS Transitions and Animations
04 | Web Applications Gerry O’Brien | Technical Content Development Manager Paul Pardi | Senior Content Publishing Manager.
State management & Master Pages in asp.net
Lý thuyết 3 tiết Thực hành 6 tiết
HTML 5 SEMANTIC ELEMENTS.
ASP.NET Imran Rashid CTO at ManiWeber Technologies.
Active server pages (ASP.NET)
ASP.NET 2.0 Overview Created By: Ajay Bahoriya.
Presentation transcript:

Using ASP.NET Master Pages Svetlin Nakov Technical Trainer http://nakov.com Telerik Software Academy academy.telerik.com

Table of Contents Master Pages and Content Pages Nested Master Pages * 5/30/201807/16/96 Table of Contents Master Pages and Content Pages Nested Master Pages (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.*

Master Pages and Content Pages * 5/30/201807/16/96 Master Pages and Content Pages (c) 2005 National Academy for Software Development - http://academy.devbg.org. All rights reserved. Unauthorized copying or re-distribution is strictly prohibited.* 3##

Master and Content Pages Assume we have a classical web site like this:

The Master Page – Sections The header is shared between all pages: Header

The Master Page – Sections (2) The navigation is shared between all pages: Navigation

The Master Page – Sections (3) The footer is also shared between all pages: Footer

The Content Pages The content is different for all pages: Content

Why Use Master and Content Pages? Master pages provide reusable UI templates The structure of the site is repeated over most of its pages ASP.NET master pages allow to share the common HTML between few pages Common Look & Feel To avoid the repeating (and copying) of HTML code and the logic behind it

ASP.NET Master Pages Master pages in ASP.NET Web Forms start with the @Master directive Mostly the same attributes as the @Page directive Master pages can contain: Markup for the page (<html>, <body>, …) Standard contents (HTML, ASP.NET controls) <asp:ContentPlaceHolder> controls which can be replaced in the content pages

Content Pages Content pages derive the entire content and logic from their master page Use the @Page directive with MasterPageFile attribute pointing to the master page Replace a <asp:ContentPlaceHolder> from the master page by using the <asp:Content> control Set the ContentPlaceHolderID property Points to the ContentPlaceHolder from the Master page which content we want to replace

Master and Content Pages – Mechanics Site.master Default.aspx (content page) <%@ Master %> <%@ Page MasterPageFile= "~/Site.master" %> Header Navigation <asp:Content ContentPlaceHolderID "MainContent"> Here we put the contents with which we want to replace the default ones </asp:content> <asp:ContentPlaceHolder ID="MainContent"> Here we put the default content </asp:ContentPlaceHolder> Footer

Using Master Pages Live Demo

Master and Content Pages – Advanced We can change the Master page at runtime in the code-behind We can also select the Master page according to the browser type Page.MasterPageFile = "~/SiteLayout.master"; <%@ Page Language="C#" ie:MasterPageFile="~/IESiteLayout.master" mozilla:MasterPageFile="~/FFSiteLayout.master" %>

Nested Master Pages Master pages can be nested, with one master page referencing another as its master Nested master pages allow creating componentized master pages A child master page has the file name extension .master, as any master page <% @ Master Language="C#" %> // Parent Master Page <asp:ContentPlaceHolder ID="MainContent" runat="server" /> <%@ Master Language="C#" MasterPageFile="~/Parent.master"%> <asp:Content ID="Menu" ContentPlaceholderID="MainContent" runat="server"> <asp:ContentPlaceHolder ID="LeftMenu" runat="server" /> <asp:ContentPlaceHolder ID="TopMenu" runat="server" /> </asp:Content> // Child Master Page

Nested Master Pages Live Demo

Master Pages ? ? ? ? ? ? ? ? ? http://academy.telerik.com

Exercises Implement a simple Web Forms application using master pages. The application should be like a user profile – separate pages for Personal Info, Friends, Additional Info, etc. + Sidebar for navigation. Implement a Web Forms application using nested master pages. It should be a Web site of international company. You should have master layout page and few different nested master pages for each country and few content pages in different language, for each country. Define "Home", "About" and "Contacts" pages for each country using its master page.

Free Trainings @ Telerik Academy "Web Design with HTML 5, CSS 3 and JavaScript" course @ Telerik Academy html5course.telerik.com Telerik Software Academy academy.telerik.com Telerik Academy @ Facebook facebook.com/TelerikAcademy Telerik Software Academy Forums forums.academy.telerik.com