How to Use Master Pages and Site Navigation? Using Visual Studio 2008 Designer?
Master Pages is a feature coming in ASP.NET 2.0, which enables to create sites with a common appearance driven by a single template. You can create a single template page that can be used as a foundation for any number of ASP.NET content pages in your application.
Create a web site with a consistent layout and design across all its pages using ASP.NET 2.0 MasterPages. See how easy it is to add navigation to a web site using the new TreeView and SiteMapPath controls.
Using Menu and Navigation in visual studio watch more videos at ... MasterPages no Visual Studio 2008
Using Visual Studio 2008 Designer
The great thing in master pages in Visual Studio 2008 is that you can use the designer and switch to code as any .aspx page. For example for the following master page:
<%@ Master="" Language="C#" AutoEventWireup="true" CodeBehind="Site2.master.cs" Inherits="MasterPages.Site2" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<table cellpadding="3" border="1">
<tr bgcolor="yellow">
<td colspan="2">
<h1>My Home Page</h1>
</td>
</tr>
<tr>
<td>
<asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">
</asp:ContentPlaceHolder>
</td>
<td>
<asp:ContentPlaceHolder ID="ContentPlaceHolder4" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td colspan="2">
Copyright 2009
</td>
</tr>
</table>
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Lets change the Default.aspx page as follow:
<%@ Page="" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MasterPages._Default" MasterPageFile="~/Site2.Master" %>
<asp:content ID="Content1" ContentPlaceHolderID="head" runat="server">
Default page
</asp:content>
<asp:content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
This is the content for the default page.
</asp:content>
<asp:content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
ContentPlaceHolder3
</asp:content>
<asp:content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder4" runat="server">
ContentPlaceHolder4
</asp:content>
Master Pages & Site Navigation Using Visual Studio 2008 Designer HTML JavaScript Dreamweaver Tutorial Working with Master Pages
Master Pages & Site Navigation Using Visual Studio 2008 Designer HTML JavaScript Dreamweaver Tutorial Working with Master Pages
Hot on Web: