シナリオ
asp.netマスターページを使用しているアプリケーションがあり、ページの上部と下部でいくつかのコンテンツを繰り返したいと思っています。現在、私は次のようなものを使用しています:
マスターページ<html>
<body>
<asp:ContentPlaceHolder ID="Foo" runat="server">
</asp:ContentPlaceHolder>
<!-- page content -->
<asp:ContentPlaceHolder ID="Bar" runat="server">
</asp:ContentPlaceHolder>
</body>
</html>
コンテンツページ
<asp:Content ID="Top" ContentPlaceHolderID="Foo" runat="server">
<!-- content -->
</asp:Content>
<asp:Content ID="Bottom" ContentPlaceHolderID="Bar" runat="server">
<!-- content repeated -->
</asp:Content>
メンテナンス
ご存知のように、コードで物事を繰り返すことは通常良くありません。メンテナンスの問題が発生します。以下は私がやりたいことですが、id属性が繰り返されているため明らかに機能しません。
マスターページ<html>
<body>
<asp:ContentPlaceHolder ID="Foo" runat="server">
</asp:ContentPlaceHolder>
<!-- page content -->
<asp:ContentPlaceHolder ID="Foo" runat="server">
</asp:ContentPlaceHolder>
</body>
</html>
コンテンツページ
<asp:Content ID="Top" ContentPlaceHolderID="Foo" runat="server">
<!-- content (no repetition) -->
</asp:Content>
可能?
asp.net Webフォームを使用してこれを行う方法はありますか?ソリューションは必ずしも上記のコンテンツに似ている必要はなく、同じように機能する必要があります。
ノート
VisualStudio2008でasp.net3.0を使用しています