Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 17th, 2006, 02:36 PM
Registered User
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Master Pages: Overriding header content

Hi,
I am building a site that uses nested master pages. I want to use a separate style sheet on the nested master. I found info on how to override the master page content and have tried to implement it, but the css on the nested page is not being recognized (it's pulling the css being used on the master page instead). The code I currently have is below. I have a feeling it is a simple fix but I've been looking at it for so long I can't see the forest for the trees!

MASTER PAGE HEAD ELEMENT:
<head runat="server" id="Head1">
    <asp:contentplaceholder id="headContent" runat="server">
     <title>Old Mutual Financial Network</title>
     <link id="omfnstyle" href="omfn.css" rel="stylesheet" type="text/css" />
      </asp:contentplaceholder>
</head>


NESTED MASTER PAGE HEAD PLACEHOLDER:
<asp:Content id="EspanolHeadContent" ContentPlaceHolderID="headContent" runat="server">
    <title>OMFN: En Espa#241;ol </title>
    <link href="~/espanol/espanol-spanish.css" type="text/css" rel="stylesheet">
</asp:Content>

Note: the css the nested page refers to is inside of another directory. However, the nested master page is in the top level directory.

Thanks,
S~

 
Old July 21st, 2006, 10:57 AM
Authorized User
 
Join Date: Jul 2004
Posts: 69
Thanks: 0
Thanked 1 Time in 1 Post
Default

The "~" directory shortcut is not made available to non-server side controls. It isn't that your browser is not looking for the file, it just doesn't understand the "~".... i think. :)

you could try adding runat="server" to the link and see if it parses the href property properly.

www.CoderForRent.com
Get A Computer Job!

www.ComputersComplete.com
Computer Parts & Accessories
 
Old July 24th, 2006, 12:16 PM
Registered User
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
Thanks for the reply. You were right. I tried adding runat=server but it still didn't work. Then I replaced the "~" with traditional "../" and it worked.

Thanks again,
sankerbrand






Similar Threads
Thread Thread Starter Forum Replies Last Post
Master Pages, Content Pages and CSS carliviris Visual Studio 2005 0 January 8th, 2008 05:56 PM
Master pages wunnavabk ASP.NET 2.0 Professional 1 June 25th, 2007 07:09 AM
Master Page refresh only the content skyler ASP.NET 2.0 Professional 5 May 2nd, 2007 06:52 AM
java script in master or content pages msathyaprasad90 ASP.NET 2.0 Professional 2 December 28th, 2006 04:57 PM
Master Page/Content Pages coleenh ASP.NET 2.0 Basics 1 September 26th, 2006 02:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.