Hello,
I am trying to create a site with nested master pages.The overall master page contains a banner and a horizontal menu (see Application.master below).
For each of the menu entries there is a separate section, with a specific vertical menu at the left.There should be one subdirectory for each section, each one containing a sub master page for the section (see. Section.master) below.
The directory and file structure is like this:
/ Application.master
/organisation/
Section.master
Page_1.aspx
Page_2.aspx
Page_3.aspx
/production/
Section.master
Page_1.aspx
Page_2.aspx
Page_3.aspx
This worked fine, as long as I had only one section, and thus, only one sub master page Section.master.Then, I created another subdirectory, containing another Section.master page.
This caused the following compile error:
'MainContent' is already declared as 'Protected WithEvents MainContent As System.Web.UI.WebControls.ContentPlaceHolder' in this class.\production\Section.master.designer.vb
Ok, I saw that the second Section.master.vb file contained a class "Section", which is also contained in the other Section.master file, so I renamed it to "Section_Production". But the error remained.
When double clicking on the error message, I was taken to "Section.master.designer.vb", which seems to be a generated file. This file still contained the directive "Partial Public Class Section", which seems to cause the naming conflict...
However, I still would like to have one Application.master page at the root level, several sub directories and each of them contain one Section.master file.How can I do this without naming conflicts?
Thank you very much
Yeoman
--- Application.master
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Application.master.vb" Inherits="GovApplication.Application" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel="Stylesheet" type="text/css" href="~/apl/css/web.css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<div class="apl_heading">
<h1>StMGP</h1>
<p>Gebäudeverwaltung.</p>
</div>
<form id="form1" runat="server">
<div>
<asp:Menu ID="Menu1" runat="server" BackColor="#B5C7DE" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284E98" Orientation="Horizontal" StaticSubMenuIndent="10px" Width="100%">
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#284E98" ForeColor="White" />
<DynamicMenuStyle BackColor="#B5C7DE" />
<StaticSelectedStyle BackColor="#507CD1" />
<DynamicSelectedStyle BackColor="#507CD1" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<Items>
<asp:MenuItem Text="Home" Value="HOME" NavigateUrl="~/Default.aspx">
</asp:MenuItem>
<asp:MenuItem Text="Organisation" Value="ORG" NavigateUrl="~/apl/org/Main.aspx">
</asp:MenuItem>
<asp:MenuItem Text="Content 2" Value="CONTACT" NavigateUrl="~/ContentPage2.aspx">
</asp:MenuItem>
</Items>
<StaticHoverStyle BackColor="#284E98" ForeColor="White" />
</asp:Menu>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
--- Section.master
<%@ Master Language="VB" MasterPageFile="~/apl/Application.Master" AutoEventWireup="false" CodeBehind="Section.master.vb" Inherits="GovApplication.Section" %>
<asp:Content id="Content1" ContentPlaceholderID="MainContent" runat="server">
<div class="apl_sec_menu">
<asp:Menu runat="server" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#7C6F57" StaticSubMenuIndent="10px">
<DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicMenuStyle BackColor="#F7F6F3" />
<DynamicSelectedStyle BackColor="#5D7B9D" />
<Items>
<asp:MenuItem Text="Active Directory" Value="CMD_AD" NavigateUrl="~/apl/org/Accounts.aspx"></asp:MenuItem>
<asp:MenuItem Text="Personal" Value="" NavigateUrl="~/apl/org/Personal.aspx"></asp:MenuItem>
<asp:MenuItem Text="New Item" Value="New Item"></asp:MenuItem>
</Items>
<StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticSelectedStyle BackColor="#5D7B9D" />
</asp:Menu>
</div>
<div class="apl_sec_main">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</asp:Content>