Technology Guruu

  • Home
  • Site Info
    • About Us
    • Disclaimer
    • Privacy Polacy
  • Home
  • Digital Marketing
    • SEO
    • SMM
    • SEM
  • Quotes
  • Technical
  • Java
  • .Net
    • C#.Net
    • ASP.Net
  • Keychains

Friday, 27 January 2017

Brief Description About Master Pages In .Net

 Akansha     00:00:00     C#.Net, TechnicalQuestions     No comments   

Today I would like to write about master pages in Asp.net in these we are placed how to add master page to the solution explorer and how to add child pages to solution explorer with examples.

Master Pages in Asp.net

Master Pages

  • Whenever we want to have common header and common footer with in multiple pages of a web site then we can go for a Master Page implementation.
  • For example Let us assume we are developing a website with 10 pages, All the web pages are having same header and same footer instead of designing same header and same footer with in 10 pages, We will design a master page with the common header and common footer once then the master page we can consume that by that 10 pages which are called as child pages.
  • To develop a master page we have a predefined template called master page.

How To Add Master Page To The Solution Explorer

Step 1: Open solution explorer
Step 2: Select application name, Right click add new item
           It will open add new item window
           Here we are select a predefined template called Master page 
           click add button with this process one master page will be added to the solution explorer                    window  
ASP.Net extension of the master page will be master. Every page will be .Master
Every master page mainly representing with 2 files
1. .Master
2. .Master.cs
1. .Master:
                 This file will support two modes
                  a) Design Mode
                  b) Source Mode

Structure of the Master Page source window(.master)

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

2. Master.cs:
                 It will contain the business logic of the master page

Structure of the Master Page  Class File(.master.cs) 

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}

How To Add Child Page To The Solution Explorer

Step 1: Open solution explorer 
Step 2: Select web application name right click select add new item
           It will open a add new item window
           Here select a template called web form click add button
Step 3: Here check the below check box like 
           Select master page
           Click add button
           It will open a window like select a master page. Here select a file MasterPage.master
           Click ok button
With the above process MasterPage will be add to a child page called webform1.aspx
as well as a child page called webform1.aspx will added to solution explorer window

Structure of the Child Page .aspx code window


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

Structure of the Child Page .aspx.cs


public partial class WebForm1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}

Are you looking for more articles on .net I wrote More Articles on C#.Net and Asp.Net i think those also helpful to you.
1.Complete info about Access Modigiers
2.Complete info about Exception handling
3.Comple info about Methods Concept
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Popular Posts

  • Love Failure Quotes and Sad valentines day Quotes
    We Love Someone is a easy process sometime takes long time to love someone love others within short period but anyway always love dependin...
  • Brief description about Delegates
    Introduction about delegates and why delegates are came the main purpose of delegates how to useful and what are the advantages and disadv...
  • Missing My Friend Quotes : Friendship Day Quotes 2017
    Friends today my article about missing friends and moments with them. Here you are seen the best friendship quotes and some  feelings when...
  • Detail Introduction about C#.Net
    Brief Introduction about C#.Net  Introduction C#.Net is the one of the Programming Language the .Net Framework also contains ano...
  • Na Tanu Samjhawan Ki Song lyrics
    Na Tanu Samjhawan Ki Song Lyrics With English Translation Movie : Humpty Sharma ki Dulhaniya Song : Samjhawan Song Singer : Arijit ...
  • Best Good Afternoon wishes greetings and quotes
    Top Most Good Afternoon Wishes Good Afternoon wishes are gives a relaxation in afternoon time.This wishing can be done between 12 to 3 p...
  • Top 10 valentine's day Quotes and Greetings wishes
    All Lovers have Anxiety in Valentines day because it is a festival to all lovers in these they enjoy a lot and celebrate the Valentine...
  • Brief Description about Multicast Delegate
    Multicast delegate is an extension of normal delegate. It helps you to point more than one method at a single moment of time. Multicast ...
  • Best Methods To Get A Cheap Home Insurance Deal!
    Cheap Home Insurance Home Insurance is seen as a luxury but in all honesty it is a necessity especially in the case of natural disast...
  • How to Remove Audio From Any Video Using VLC Media Player?
    Step by Step Procedure for  Remove(Mute) Audio in a Video Using VLC  Player A picture is worth a thousand words and a video is worth a t...

Categories

  • Entertainment (67)
  • TechnicalQuestions (58)
  • Quotes (11)
  • C#.Net (8)
  • Java (8)
  • ValentinesDay (4)
  • SEO (3)
  • Home
  • About Us
  • Disclaimer
  • Privacy Policy
  • Sitemap

Copyright © 2015-2017 Good Friends 5.All Rights Reserved• And Our Sitemap • All Logos and Trademark Belongs To Their Respective Owners•