ASP.Dot.NET.2.0.Revealed [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

ASP.Dot.NET.2.0.Revealed [Electronic resources] - نسخه متنی

Patrick A. Lorenz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










Nested Master Pages



It''s possible to nest Master Pages, though this will certainly be an exception rather than a rule. To do so, you can define an additional (parent) Master Page for an existing Master Page and so on. This approach is very useful for times when you want to modify a comprehensive layout and use it for different areas of your web site.




The example in Listing 4-5 comes from the online help. You can already use this example in the Alpha version. The IDE, however, is still facing some difficulties with regard to nesting Master Pages that will probably be corrected in the Beta version. Figure 4-6 shows the nested Master Pages in action.




Figure 4-6: Both master pages are merged with the Content Page.


Listing 4-5: Nesting Master Pages








// MasterMasterPage5.master (Parent Master)
<%@ Master Language="C#" %>
<html>
<body>
<form id="Form1" runat=server>
<h1>Parent Master</h1>
<p>
<font color=red>This is Parent-master content.</font>
</P>
<asp:contentplaceholder id="MainContent" runat=server/>
</form>
</html>
</body>
// MasterPage5.master (Child Master)
<%@ master language="C#" master="~/MasterMasterPage5.master" %>
<asp:content id="Content1" contentplaceholderid="MainContent" runat="server">
<asp:panel runat="server" id="panelMain" backcolor="lightyellow">
<h2>Child master</h2>
<asp:panel runat="server" id="panel1" backcolor="lightblue">
<p>This is childmaster content.</p>
<asp:contentplaceholder id="Content1" runat="server" />
</asp:panel>
<asp:panel runat="server" id="panel2" backcolor="pink">
<p>This is childmaster content.</p>
<asp:contentplaceholder id="Content2" runat="server" />
</asp:panel>
</asp:panel>
</asp:content>
// ContentPage5.aspx
<%@ page language="C#" master="~/MasterPage5.master" %>
<asp:content id="Content1" contentplaceholderid="Content1" runat=server>
<asp:label runat="server" id="Label1"
text="Child label1" font-bold=true/>
<br>
</asp:content>
<asp:content id="Content2" contentplaceholderid="Content2" runat=server>
<asp:label runat="server" id="Label2"
text="Child label2" font-bold=true/>
</asp:content>












/ 133