Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.net what is MasterPageFile attribute?

Tags:

asp.net-mvc

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ModelCentral.AbModel>" %>

ASP.net what means is MasterPageFile attribute?

like image 505
user3112115 Avatar asked Sep 16 '25 20:09

user3112115


1 Answers

Each .aspx page can reference a master page. The master page can define the general layout for that specific page (obviously you can use a masterpage for multiple pages).

Imagine you have a standard website with a main menu, a content area and a footer. The master page would include the main menu and the footer since they usually don't change. Moreover the master page contains a <asp:ContentPlaceholder> which will later be populated by the content of your .aspx-page.

A master page can contain multiple <asp:ContentPlaceholder>. In your .aspx-page you can use the <asp:Content> control to populate a <asp:ContentPlaceholder> with your content. Note that you have to match the ContentPlaceHolderID of your <asp:Content> with the correct ID of your `.

Read this article for more information on the subject.

like image 154
mboldt Avatar answered Sep 18 '25 16:09

mboldt