top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

    Get Free Article Updates

Facebook Login
Site Registration
Print Preview

How do you create Master Page?

0 votes
45 views

Steps to create Master Page:

- Right-click your web project in the Solution Explorer window
- Select Add New Item.
- Select the Master Page item type from the Add New Item dialog.

Following is an example of Master Page and a Content Page.

<%@ Master %>
<html>
<body>
<Title>Title of the Pages</Title>

<asp:ContentPlaceHolder id="Content1" runat="server">
</asp:ContentPlaceHolder>
</body>
</html>


- This is simple HTML page that serves template for other pages.
- The @ Master directive at the top of the page defines that the page is Master Page. 
- A placeholder tag <asp:ContentPlaceHolder> is overridden by the content page to place the content.
- You can have many placeholders tag each of them with different id.

Content Page Example 

%@ Page MasterPageFile="master1.master" %>
<asp:Content ContentPlaceHolderId="Content1" runat="server">
<h1>ASP Interview Questions</h1>
</asp:Content>


When you request this page, ASP.NET merges layout specified in the Master Page and content of content page to produce page result.

posted Mar 13 by Shivaranjini

  Promote This Article
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...