Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 17th, 2006, 02:36 PM
Registered User
Join Date: Jul 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Master Pages: Overriding header content

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!

<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: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">

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


Reply With Quote
  #2 (permalink)  
Old July 21st, 2006, 10:57 AM
Authorized User
Join Date: Jul 2004
Location: , , .
Posts: 69
Thanks: 0
Thanked 1 Time in 1 Post

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.

Get A Computer Job!

Computer Parts & Accessories
Reply With Quote
  #3 (permalink)  
Old July 24th, 2006, 12:16 PM
Registered User
Join Date: Jul 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

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,

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 08:53 AM.

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