You are on page 1of 2

Introduction to MasterPages in ASP.

NET
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. !ou can then create individual content pages that contain the content you want to display. "hen users re#uest 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. Example Masterpage.master
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master. s" !n"erits="MasterPage" %# <"tml"# <"ead runat="server"# <title#<$title# <asp%ContentPla e&older id=""ead" runat="server"# <$asp%ContentPla e&older# <$"ead# <'od(# <)orm id=")orm*" runat="server"# <div# <div st(le=""eig"t%+,,p-. /idt"%*,,%. 'a 0ground1 olor% Lime. te-t1 align% enter. )ont1si2e%-1large"#3"is is a Master Page<$div# <asp%ContentPla e&older id="ContentPla e&older*" runat="server"# <$asp%ContentPla e&older# <$div# <$)orm# <$'od(# <$"tml#

Content Page(Default.aspx)
<%@ Page 3itle="" Language="C#" MasterPageFile="4$MasterPage.master" AutoEventWireup="true" CodeFile="5e)ault.asp-. s" !n"erits="65e)ault" %# <asp%Content !5="Content*" ContentPla e&older!5=""ead" 7unat="8erver"# <$asp%Content# <asp%Content !5="Content+" ContentPla e&older!5="ContentPla e&older*"

7unat="8erver"# 3"is is Content Page <$asp%Content#

You might also like