understanding master page

understanding asp.net master page:-

characteristics of the asp.net master page:-

  • master page is not homepage.
  • extension of the master page is .master
  • it has code-behind file.
  • it cannot run directly.
  •  it can be nested
  • it allows centralizing the common functionality of the pages so that we can make updates at one place only.
  • the website can contain many websites.

—> you can create multiple master pages to define different layouts for parts of your site and a different set of content pages for each master pages.

  • you can use controls on the master page to create a menu that applies to all pages.
  • a master page has 2 parts:
  1. content that appears on each page that inherits the master page.
  2. regions that can be customized by the pages inheriting the master pages.
  • a master page needs to specify both the parts common to all pages and the parts that are customized.
  • you inherit the items and add to the master page and it will appear on all pages.
  • use contentplaceholder controls to specify a region that can be customized.
  • the master page contains at least one contentplaceholder.
  • runtime we can change the master page.

how to create the master page?

creating master page

creating master page

master page

master page

code:-

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>


—> master page have,

we will see these 4 points in next article in details.

 













Reply