Multiple Levels of Master Pages
来源:互联网 发布:韩端机器人编程难吗 编辑:程序博客网 时间:2024/05/20 05:56
This feature provides a way to display standard content from several levels of hierarchy. For
example, a Content page named Publication.aspxcan establish its Master as Research.master,
which can in turn declare its Master as Corporate.master. The final rendering will be of Research
.aspxsurrounded by Research.master, and all of that surrounded by Corporate.master. One prob-
lem is that the space remaining for content is reduced at each level. VWD does not contain automatic
tools to create multiple levels of Masters. In fact, if you have multiple levels, you can only open those
pages in Source View.
To create pages with multiple levels of Masters you must include in the middle-level page tags that both
indicate its Master page (up a level) and its content placeholders (for the lower level). Recall that a
Master page must have <%@Master...%>on the first line, and that a lower-level or Content page must
have <%@PageMasterPageFile=%>on its first line. In the case of a middle page that is both a Content
and Master page, the tag must start with <%@Master...and also contain ...MasterPageFile=%>.
Also recall that a Master page contains an <asp:ContentPlaceHolder>tag whereas the Content page
has an <asp:content>tag. In the case of a middle layer, there must be an <asp:content>holding the
ID of the Master’s <ContentPlaceHolder>tag. Then within that tag there is an <asp:
ContentPlaceHolder>tag that will be used by the next level down.
The following example illustrates a Corporate Master page, then a Research department Master page,
and finally a Publication.aspxpage that holds the content. The Corporate page is shown in the fol-
lowing code. Note that its content placeholder is defined in the shaded lines:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” >
<head runat=”server”>
<title>CorporateMaster</title>
</head>
<body>
Corporation Name
<form id=”form1” runat=”server”>
<div>
<asp:contentplaceholder
id=”ContentPlaceHolderCorporate”
runat=”server”>
</asp:contentplaceholder>
</div>
</form>
</body>
</html>
The Research department Master page is illustrated by the following code. This page is the most com-
plex, because it is a Content page for the Corporate page, and a Master page for the Publication page.
Notice the use of Masterand MasterPageFile=on the first line that establishes this as content for the
Corporate Master page. Then observe that the <asp:ContentPlaceHolder>will house other pages as
content (in this case the Publication page). The content placeholder must sit wholly within the
<%@ Master MasterPageFile=”~/Corporate.master” Language=”C#” %>
<asp:Content runat=”server”
ContentPlaceHolderID=”ContentPlaceHolderCorporate”>
Research Department
<asp:contentplaceholder
id=”ContentPlaceHolderResearch”
runat=”server”>
</asp:contentplaceholder>
</asp:Content>
Code for the Publication.aspxpage (designed with content only) is shown in the following code.
Here you only need to designate a Master page. This page, which sits at the lowest level, is not a Master
page:
<asp:Content ID=”Content1”
ContentPlaceHolderID=”ContentPlaceHolderResearch”
Runat=”Server”>
Publication text
</asp:Content>
- Multiple Levels of Master Pages
- LoadRunner levels of integration with web pages
- master pages控件使用说明
- 了解Master Pages库
- 母版页(Master Pages)
- ASP.Net 2.0 - Master Pages
- Inside ASP.NET Master Pages
- Page Layouts and Master Pages
- 母版页(Master Pages)
- Master Pages / Content Pages. How to set the Form ID?
- Master Pages In ASP.NET 2.0
- Sharing Master Pages Across IIS Applications
- Sharing Master Pages Across IIS Applications
- Sharing Master Pages Across IIS Applications
- Master Pages Definition(SharePoint 2007 SDK)
- Master Pages and JavaScript document.getElementById
- Sharepoint Designer2010找不到Master Pages解决方法
- Creating Page Layouts with View Master Pages
- 解决php的loadXML()不能识别空格的问题
- 使用hxcomp.exe反编译MSDN文档
- 关于DRM打包时的错误
- FreeBSD查看即时网络流量
- Apache+php+MySQL安装 Step By Step
- Multiple Levels of Master Pages
- FreeBSD邮件系统安装 Step by Step
- FreeBSD下find命令的一些使用方法
- 删除Freebsd下的非法文件
- Vi编辑器的基本使用方法 (转载)
- 这就是SMARTY,一个面试者的苦恼
- 使用Python2.4在Linux下访问SQL Server(安装篇)
- FreeBSD下 自动获取网通电信IP列表
- freebsd下必须要设置的几个的参数