top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Describe the Master Page in Asp.Net?

+1 vote
394 views
Describe the Master Page in Asp.Net?
posted Jan 6, 2015 by Jayshree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Master pages in ASP.NET works as a template that you can reference this page in all other content pages. Master pages enable you to define the look and feel of all the pages in your site in a single location.

If you have done changes in master page, then the changes will reflect in all the web pages that reference master pages. When users request 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.

enter image description here

ContentPlaceHolder control is available only on master page. You can use more than one ContentPlaceHolder control in master page. To create regions that content pages can fill in, you need to define ContentPlaceHolder controls in master page as follows:

  <asp:ContentPlaceHolder ID=”ContentPlaceHolder1” runat=”server”>

</asp:ContentPlaceHolder>

The page-specific content is then put inside a Content control that points to the relevant

ContentPlaceHolder:

<asp:Content ID=”Content1” ContentPlaceHolderID=”ContentPlaceHolder1” Runat=”Server”>
</asp:Content>

Note that the ContentPlaceHolderID attribute of the Content control points to the ContentPlaceHolder that is defined in the master page.

The master page is identified by a special @ Master directive that replaces the @ Page directive that is used for ordinary .aspx pages.

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="CareerRide.master.cs" Inherits="CareerRide" %>
answer Jan 7, 2015 by Shivaranjini
...