Hi
I am developinga site whichI want to contacin 2 'sub sites' - one for business clients and one for Home clients.
I therefore want to base each 'sub site' on a slightly different master page.
I have a base master calleed master1.master:
Code:
<%@ Master Language="VB" CodeFile="Master1.master.vb" Inherits="Master1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="google-site-verification" content="M8qVTfgjXH6dJaCEjTMmkerA4eFhIduDKXOMD3pRw5E" />
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
</style>
<meta http-equiv="X-UA-Compatible" content="IE-7" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-21134926-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body id="body">
<form id="form1" runat="server">
<div id="pagecontainer">
<div id="banner">
<div id = "bannerimages">
<div id="leftbanner">
</div>
<!--- <div id="centrebanner">
</div>--->
<div id="Rightbanner">
</div>
</div>
</div>
<div id="menu">
<asp:ContentPlaceHolder id="menubar" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="leftsidebar" >
<img alt="Menu Button for Nusiness Area" src="../Images/BusinessIn_Menu.jpg" />
<img alt="White space" src="../Images/WhiteSpace.jpg" height="20px"/>
<img alt="Menu Button for Home and Soha Area" src="../Images/HomeIn_Menu.jpg" />
<asp:ContentPlaceHolder id="LeftColumn" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="maincontent" >
<asp:ContentPlaceHolder id="MainColumn" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="rightsidebar">
<asp:ContentPlaceHolder id="RightColumn" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
<div id="Bottombanner">
</div>
<div id="footer">
<p>Website design and maintenance by <a target="_blank" href="http://www.beaufortnetworks.com">Beaufort Networks Ltd</a></p>
</div>
</form>
</body>
</html>
I then created a home.master using master1.master as its master:
Code:
<%@ Master Language="VB" MasterPageFile="~/MasterPages/Master1.master" AutoEventWireup="false" CodeFile="Home.master.vb" Inherits="MasterPages_Home" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="menubar" Runat="Server">
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" align="center"
StaticEnableDefaultPopOutImage="True" MaximumDynamicDisplayLevels="3"
Width="362px">
<StaticSelectedStyle CssClass="StaticSelectedStyle" />
<StaticMenuItemStyle CssClass="StaticMenuItemStyle" />
<StaticHoverStyle cssclass="StaticHoverStyle"/>
<DynamicMenuItemStyle CssClass="DynamicMenuItemStyle" />
<DynamicHoverStyle cssclass="DynamicHoverStyle"/>
<Items>
<asp:MenuItem NavigateUrl="~/AntiVirus-SOHO.aspx"
Text="AntiVirus Solutions" Value="AntiVirus Solutions"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/Home-Backup.aspx"
Text="Backup " Value="Backup">
</asp:MenuItem>
</Items>
</asp:Menu>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="LeftColumn" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainColumn" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="RightColumn" Runat="Server">
</asp:Content>
I then created a web page using home.master as the master page:
Code:
<%@ Page Title="Antivirus software for home PCs and networks from Kaspersky" Language="VB" MasterPageFile="~/MasterPages/home.master" AutoEventWireup="false" CodeFile="AntiVirus-SOHO.aspx.vb" Inherits="Anti_Virus_SOHO" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftColumn" Runat="Server">
<img src="Images/WhiteSpace.jpg" />
<asp:Image ID="Image2" runat="server" CssClass="leftsidebar"
ImageUrl="Images/Kaspersky/kis2010_eng_medium.jpg" Height="108px" Width="90px" />
<h6>All Kaspersky products are available for free tial</h6>
<p>
Use the <a style="color: #005343; text-decoration: underline;"
99"href="Contact.aspx">Contact Form </a>to request a link to a free download and 30
day trial
</p>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainColumn" Runat="Server">
<div id="maincontent">
<h1>
Keep your PCs and home network safe...</h1>
<p>To keep your PC and home network secure from viruses, trojans and malicious
attack it is vital to install and maintain effective anti malware software.</p>
<p>We recommend the Kaspersky product range which offers solutions to meet the
simplest or most demanding requirements.</p>
<h4>Internet Security 2011</h4>
<p>... combines antivirus protection with a personal firewall and an anti-spam
filter. Kaspersky Internet Security keeps your PC or Netbook free from malicious
code, adware, spyware, hacker attacks, dialers, spam and network fraud. </p>
<h4>Kaspersky Pure</h4>
<p>... builds on Internet Security to give you the ultimate in Home Security.
Password Manager stores and protects all your passwords and personal data
providing you with safe and secure access to your preferred websites and web
forms.</p>
<h4>KryptoStorage</h4>
<p>... protects your personal data against theft and unauthorized access using cutting-edge encryption technology, and allows deleted files to be permanently erased from your computer.
Encrypted data is stored in a password-protected digital container that only you can access. </p>
</div>
</asp:Content>
BUT... on the web page all the contentplace holders are flagged as in error
eg 'Could not fine "head" in the current master page or pages' where head is replaced by each placeholder
If I change the MasterPageFile= to point at master1.master the errors go away - but of course I dont have the differences in the page (at the moment just the menu)
I have tried the suggestions in
http://forums.asp.net/t/1218788.aspx/2/10 but although the errors go away, the images in the Master1 left column don't get displayed and some of the css seems to disappear :(