【发布时间】:2012-06-29 13:57:04
【问题描述】:
是否可以在母版页的多个位置使用ContentPlaceHolder 的内容?
例如,我经常想做这样的事情:
<html>
<head>
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link rel="Stylesheet" href="../../Content/Corporate.css" />
</head>
<body>
<div id="header">
<h1>I'd like to reuse the TitleContent ContentPlaceHolder content here?</h1>
</div>
<div id="content">
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
</div>
<div id="footer">
© 2012 Acme corp.
</div>
</body>
</html>
【问题讨论】:
-
只要确保您不使用多余的 HTML。 stackoverflow.com/questions/760334/…
-
@AlexW 我不确定我是否理解您所说的 冗余 HTML 是什么意思?
标签: asp.net-mvc-2 master-pages