到目前为止本书的示例在Master页面中只使用了一个<asp:ContentPlaceHolder>在Content页面中也只使用了一个<asp:content>标记ASPNET 支持多个内容占位符但是每个占位符都必须有自己的ID如下例所示
<%@ Master Language=VB%>
<html><body>
<form id=form runat=server>
<asp:contentplaceholder runat=server id=TopContent/>
<asp:contentplaceholder runat=server id=MiddleContent/>
<asp:contentplaceholder runst=server id=BottomContent/>
</form>
</body></html>
接下来就可以将内容包含在<asp:content>标记中这些标记的ContentPlaceHolderID值与Master页面中的ID值相等
<%@ Page Language=VBMasterPageFile=~/researchmasterTitle=Untitled Page%>
<asp:Content ID=ContentlContentPlaceHolderID=TopContent Runat=Server>
Text to go in Top section
</asp:Content>
<asp:Content ID=ContentContentPlaceHolderID=MiddleContent Runat=Server>
Text to go in Middle section
</asp:Content>
<asp:Content ID=ContentContentPlaceHolderID=BottomContent Runat=Server>
Text to go in Bottom section
</asp:Content>
将内容分别存放在不同的<asp:ContentPlaceHolder>标记中有助于设计和维护Master页面的布局
ASPNET 入门教程完整版