Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Difficulty loading style sheet into ASP.Net  sub pages

Posted on 2008-06-10
5
Medium Priority
?
826 Views
Last Modified: 2010-04-21
Greetings all

 I have a MasterPage (See attached snippet). I have created a subpage from that and want to add a stylesheet (specfic to this page only, hence I only do it here).

My code:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

 <link rel="stylesheet" type="text/css"
    href="CSS_Sheets/DefaultPageOnly.css" />

<div id="leftnav">
<p>
.....................

It looks Ok to me, but I am getting "Error      1      Cannot switch views: Validation (Internet Explorer 6): Element 'link' cannot be nested within element 'div'.      ......


What is the correct and best way to do this?

In advance, thanks!

  allanmark
<div id="container" >
	<div id="header">
	<!-- Header start -->
			 <h1>Scribblers</h1>
            
            <asp:Image ID="headerPict" runat="server" CssClass="headerPic" ImageUrl="~/Graphics/Book02.jpg" />
 
          <center><ul id='menu'>
                
                <li ><a href='<%=ResolveUrl("Default.aspx")%>' id='menuHome' >Home</a></li>
                <li ><a href='<%=ResolveUrl("~/Pages_Story_Script/Stories.aspx")%>' id='menuStories' >Stories</a></li>
 
                
             </ul>
          </center>
          
	<!-- Header end -->
	</div>
	
	<div id="body">
    <!-- Body start -->
	    <div id="dummy" style="position:relative; height: 120px"></div>
		
		
	<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
        </asp:contentplaceholder>
 
        
        <!-- Give a little space -->
        <div style="height:10px"></div>
        
    <!-- Body end -->
	</div>
	
	<div id="footer">
	<!-- Footer start -->
		  <hr align="center" color="Black" width="75%" />
          <label class="smallerFontSize">Copyright Scribblers @ 2008</label>                          
 
	<!-- Footer end -->
	</div>
	
</div>
</form>
 
</body>
 
</html>

Open in new window

0
Comment
Question by:allanmark
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Assisted Solution

by:skiltz
skiltz earned 750 total points
ID: 21751015
You can place a contentplaceholder in the head section of the masterpage and then in the child place the stylesheet information in that contentplaceholder
0
 

Author Comment

by:allanmark
ID: 21751178
Ok.

What do I have to put in?

Also, won't that style sheet then be available/loaded into all content pages?

oops ... I see that the beginning part of my Master source was chopped off - re-attached below.

allanmark
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Scribble01.master.cs" Inherits="Scribble01" %>
 
<!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 id="Head1" runat="server">
    <title>Scribbles(2) Master</title>
    
    <link rel="stylesheet" type="text/css" 
    href="CSS_Sheets/Scribble.CSS" />
    
</head>
 
<body id="MasterBody" runat="server" >
 
<form id="form1" runat="server" style="height: 100%;">

Open in new window

0
 
LVL 7

Accepted Solution

by:
skiltz earned 750 total points
ID: 21751219
<head id="Head1" runat="server">
    <title>Scribbles(2) Master</title>
   
<asp:contentplaceholder id="header" runat="server" />
   
</head>

child page
load stlyesheet into header contentplaceholder
0
 

Author Comment

by:allanmark
ID: 21751518
Did this:

<head id="Head1" runat="server">
    <title>Scribbles(2) Master</title>
    <link rel="stylesheet" type="text/css"
    href="CSS_Sheets/Scribble.CSS" />    
    <asp:contentplaceholder id="ccsPlaceHolderr" runat="server" />  
</head>

Got this:-

Error      1      Unrecognized tag prefix or device filter 'asp'.      

What have I missed?
0
 

Author Closing Comment

by:allanmark
ID: 31465722
ThankYou!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question