MasterPages是www. MetaBuilders.com提供的一个组件。其功能是将一个页面分为不同部分,按层的感觉嵌套。
类名
简介
Content
This control contains the content for a particular region
此控件包含的内容是一个详细的Region对象。
ContentContainer
This control serves two distincts purposes: - it marks the location where the Master Page will be inserted into the Page - it contains the various Content sections that will be matched to the Master Page's Region controls (based on their ID's).
此控件提供两个不同的功能:一,在当前页标记要插入的Master Page区域。二,它包括不同的内容段以相配在Master Page中的Region对象(以他们的ID相匹配)
NoBugForm
A server form that does not cause a problem by being inside a master page or other naming container.
服务端表单没有引起问题从Master Page引入端或者其它的名称容器(Container)
Region
The control marks a place holder for content in a master page.
此控件标记一个在Master Page的区域的内容。
例子:
Default.aspx
<%@ Page Language="C#" %><%@ Register TagPrefix="mp" Mamespace="MetaBuilders.WebControls.MasterPages" Assembly="MetaBuilders.WebControls.MasterPages" %>
<mp:contentcontainer runat="server" id="MPContainer" MasterPageFile="~/Master.ascx"><mp:content id="MasterContent" runat="server"> 这是Default.aspx 的内容</mp:content></mp:contentcontainer>
Master.ascx
<%@ Register TagPrefix="mp" Namespace="MetaBuilders.WebControls.MasterPages" Assembly="MetaBuilders.WebControls.MasterPages" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><body><mp:nobugform runat="server"><h1>This Is In BasicMaster</h1><hr><mp:region id="MasterContent" runat="server">Default Content</mp:region><hr><h1>This Is In BasicMaster</h1></mp:nobugform></body></html>
用法:
Master.ascx为框板用户控件。在其中使用region标记出以后需要嵌入内容的位置。
Default.aspx中使用contentcontainer得到模板,使用content与Master.ascx中的region标记为配套引用。