Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > Visual Web Developer 2008
|
Visual Web Developer 2008 Discuss creating ASP.NET 3.5 sites with Microsoft's Visual Web Developer 2008. If your question is more specific to a piece of code than the Visual tool, see the ASP.NET 3.5 forums instead. If your question is specific to the "Express Edition" be sure to state that in your post.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2008 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 April 8th, 2009, 03:00 PM
Authorized User
 
Join Date: Mar 2009
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Unhappy content pages don't display .master page elements

Hi everyone,

I have been all over the net looking for anyone who has had this same issue.

Again, I am a student, learning from an outdated book P2P Asp.Net 2.0 while using VWD 2008(I know, stupid huh? Not my idea...totally the colleges fault!)

So here is my issue.

We are working from chapter 2 of the ASP.NET 2.0 book. Creating master pages. I get everything set up, it tests out perfectly in the VWD. Upload to the schools server, and I get a Parse error that tells me the site.master cannot be found. SO.... I removed the "~/" from the site.master pathway (I have even tried "./" and "/" and "/.../") and it pulls in the textual content of the master page, the title, the navigation, and the footer text, but fails to pull in the graphics and the css formatting which (I believe) is 100% dictated by the site.css.

I cannot resolve what specifically is preventing the .css from displaying on the content page. Any ideas on this would be greatly appreciated. As I said, it tests fine in VWD (F5) but once uploaded it fails to display the css. All otehr projects so far have displayed without a hitch, so the school server does support.aspx.

I have been working on this for three solid days now...and it was either post here...or throw myself along with my pc out the freakin' window.

You are my last resort before I jump.

Please HELP!!!!!!!!!

CODE from master page:
<%@ Master Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="PageHead" runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<link href="site.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="MainForm" runat="server">
<div id="header">
<div id="logo"></div>
<h1>Wrox United</h1>
</div>
<div id="sidebar">
<h3>Navigation</h3>
</div>
<div id="content">
<div class="itemContent">
<asp:ContentPlaceHolder id="mainContent" runat="server">

</asp:ContentPlaceHolder>
</div>
</div>
<div id="footer">
<p class="left">
All images and content copyright &copy; Wrox Press and its subsudiaries 2009.
</p>
<p class="right">
Website Designed by
<a href="http://www.frogboxdesign.co.uk" title="croak">Frog Box Design</a>
</p>
</div>
</form>
</body>
</html>


Code from Content page:

<%@ Page Title="" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="About.aspx.vb" Inherits="About" %>

<script runat="server">

</script>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" Runat="Server">
<p>
The site was intitially written by Dave, while the design and graphics were done
by Lou. Conformance is XHTML 1.0 Transitional and CSS 2.1.
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="http://www.frogboxdesign.co.uk" title="ribbit" Target="_blank">Frog Box Design</asp:HyperLink>
</p>
</asp:Content>


Thanks for any advice you can give... unless it is telling me to jump.

Kip
 
Old April 8th, 2009, 03:55 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Where is site.css located in relation to site.master? Are they in the same directory? That's the way you have it set up.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old April 8th, 2009, 04:21 PM
Authorized User
 
Join Date: Mar 2009
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi,

THANK YOU for the speedy reply.

Yes, everything is in the same directory. The web.config file does not reside on the server, we are asked not to upload it to the school webspace.

Directory contains the following:

notes(empty folder)
app_data (empty folder)
images
-(folder full of images)
about.aspx
-about.aspx.vb
default.aspx
-default.aspx.vb
site.master
site.css
web.config

K.
 
Old April 8th, 2009, 04:33 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Is it only the images specified in the CSS that you're not seeing, or are the rules also not being applied?

If the rules are being applied but you don't have images, the URLs in the CSS file are not correct.

If none of the CSS is working (rules and images), then the application is not correctly resolving the <link> tag, which is weird because that should be happening automatically as long as <head> is a server control, which you've taken care of with runat="server".

Are you still getting the Parse error?

Do us a favor... run default.aspx. See if it works. If it does not work, do a View > Source and tell us what you see for the rendered <link> tag. Not as you wrote in in your code, but as it is actually ending up in the rendered page source...
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old April 8th, 2009, 05:03 PM
Authorized User
 
Join Date: Mar 2009
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Lee,
You get the hero of the week award. Thanks for taking the time.

Here is what I see once the page is uploaded.

http://webspace.westwood.edu/karenec...ss1/About.aspx

http://webspace.westwood.edu/karenec...1/Default.aspx

(this page is not a site.master contentpage, but it does have the site.CSS linked to it)

It pulls in site.master text information only when I remove the "~/" from the
<%@ Page Title="About" Language="VB" MasterPageFile="site.master" AutoEventWireup="false" CodeFile="About.aspx.vb" Inherits="About" %>

or I use "./" in front of the site.master
<%@ Page Title="About" Language="VB" MasterPageFile="./site.master" AutoEventWireup="false" CodeFile="About.aspx.vb" Inherits="About" %>

The page fails to pull in the css formatting and images. I though it might be the url in the css, because it is pulling the header, navigation, & footer text information but leaving out all graphics and text formating...but the urls appear to be correct. They all point to the images folder as they should... and like I said it tests fine in VWD, but not once online.

If I put the "~/" back in, then I get this error:
Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The file '/site.master' does not exist.

Source Error:

Line 1: <%@ Page Title="About" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="About.aspx.vb" Inherits="About" %>
Line 2:
Line 3: <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
Source File: /kareneckstrom/gd_436/asp.net/week4/Ass1/About.aspx Line: 1

Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433





Here is the CSS:
html, body {
background-color: #fff;
color: #000;
font: normal 90%/1.8em 'Lucida Grande', Verdana, Geneva, Lucida, Helvetica, Arial, sans-serif;
margin: 0;
height: 100%;
}
h1 {
font-size: 1.8em;
font-weight: bold;
margin-top: 0em;
margin-bottom: 0em;
color: #a83930;
}
h2 {
font-size: 1.6em;
margin: 1.0em 0em 1.0em 0em;
font-weight: bold;
color: #a83930;
}
h3 {
font-size: 1.2em;
margin: 1.0em 0em 1.0em 0em;
font-weight: bold;
color: #a83930;
}
p {
font-size: 1.1em;
line-height: 1.8em;
margin: 1.1em 0em 1.1em 0em;
text-align: left;
}
ul
{
font-size: 1.1em;
}
a:link, a:visited {
color: #cc3300;
text-decoration: underline;
}
a:hover {
text-decoration: none;
}
a:active {
color: #ff9900;
text-decoration: underline;
}
title {
color: #a83930;
}
#header {
height: 100px;
padding: 0 10px 0 10px;
color: #a83930;
background-color: #fdea12;
background: url(images/bg_1.gif) repeat top left;
border-bottom: 2px solid #a83930;
}
#header h1 {
padding: 10px 0 0 0;
margin: 0 0 0 200px;
color: #a83930;
margin-left: 200px;
}
#logo {
background-color: #fdea12;
background: url(images/logo.gif);
background-position: top left;
background-repeat: no-repeat;
height: 100px;
width: 100px;
border: 0;
float: left;
}
#content {
margin-left: 210px;
padding: 0 20px 1.8em 10px;
background-color: #fff;
}
.code {
color: #a83930;
background-color: #fdea12;
font: 0.9em/1.4em verdana, arial, helvetica, sans-serif;
float: right;
border: solid 1px #a83930;
padding: 10px;
}
.code a:link, #breadcrumbs a:visited,
.code a:hover, #breadcrumbs a:active {
color: #a83930;
}
#breadcrumbs {
color: #fdea12;
background-color: #a83930;
padding: 10px;
float: right;
clear: left;
margin-bottom: 1.8em;
}
#breadcrumbs a:link, #breadcrumbs a:visited,
#breadcrumbs a:hover, #breadcrumbs a:active {
color: #fdea12;
}
#sidebar {
float:left;
padding: 0 10px 10px 10px;
background-color: #a83930;
background-image: url(images/bg_2.gif);
background-repeat: repeat-y;
background-position: top left;
border-top: 2px solid #fdea12;
border-bottom: 2px solid #a83930;
width: 168px; /* ds */
}
html>body #sidebar {
width: 180px;
}
#sidebar h3 {
font-weight: bold;
padding-bottom: 0.5em;
border-bottom: 1px dashed #fdea12;
color: #fdea12;
}
#nav {
}
#nav li {
display: inline; /* for IE5 and IE6 */
}
#nav ul {
margin-left: 0;
padding-left: 0;
list-style-type: none;
}
#nav a:link, #nav a:visited {
display: block;
width: 99.99%; /* for IE5 */
color: #fdea12;
text-decoration: none;
padding: 0.25em 0.5em 0.25em 0.5em;
font-weight: bold;
}
#nav a:hover {
text-decoration: none;
color: #a83930;
background-color: #fdea12;
}
.dynamicMenu {
background-color:#a83930;
border-color: #fdea12;
border-style: solid;
border-width: 1px;
}
.dynamicMenuItem
{
background-color: #a83930;
border-color: #fdea12;
border-style: solid;
border-width: 1px;
}
.login {
color: #a83930;
background-color: #fdea12;
padding: 10px;
margin-top: 10px;
font: normal 1.1em/1.1em verdana, arial, helvetica, sans-serif;
}
.login td {
color:#a83930;
background-color: #fdea12;
font: bold 0.8em/0.8em verdana, arial, helvetica, sans-serif;
}
.login td.title {
color: #a83930;
font: bold 1.0em/1.0em verdana, arial, helvetica, sans-serif;
text-align: center;
padding-bottom: 10px;
}
.loggedinout {
color: #a83930;
background-color: #fdea12;
padding: 10px;
font: 0.9em/1.4em verdana, arial, helvetica, sans-serif;
}
.title {
color: #a83930;
font: bold 1.0em/1.0em verdana, arial, helvetica, sans-serif;
text-align: center;
padding-bottom: 5px;
border-bottom: #a83930 thin solid;
margin-bottom: 5px;
}
#footer {
margin-left: 210px;
padding: 0 20px 1.8em 10px;
border-top: 1px solid #a83930;
clear: both;
}
#footer p {
font: normal 0.8em/0.9em verdana, arial, helvetica, sans-serif;
color: #666;
}
#footer p.left {
float: left;
clear: left;
}
#footer p.right {
float: right;
clear: right;
}
.spacer {
clear: both;
}
dd, dt {
font-size: 0.95em;
}
#mainTitle {
font-size: 2.0em;
font-weight: bold;
visibility: hidden;
}
.pageTitle {
font-size: 1.5em;
font-weight: bold;
}
.itemTitle {
border-bottom: 1px solid #a83930;
font-size: 1.5em;
}
.itemContent {
padding-bottom: 1.8em;
}
.box {
border: solid 1px #a83930;
}
.boxFloat {
/* border: solid 1px #a83930; */
float: left;
}
.boxFloatRight {
border: solid 1px #a83930;
float: right;
}
.floatRight {
/* border: solid 1px #a83930; */
float: right;
}

.newsItem
{
padding-top: 1.0em;
border-bottom: 1px solid #a83930;
}
.newsTitle
{
font-size: 110%;
/*
float: left;
*/
}
.newsDate {
font: normal 0.9em/0.9em 'Lucida Grande', Verdana, Geneva, Lucida, Helvetica, Arial, sans-serif;
float: right;
/* clear: right; */
color: #666666;
}
.newsContent {
text-align: left;
}
.rowSelected {
background-color: #FEF268;
}

input.buttonLink
{
text-decoration: underline;
border: 0px;
background-color: Transparent;
}

.grid {
margin-bottom: 10px;
}
.grid TR TD {
padding: 1px 5px 1px 5px;
}

.details, .details TR, .details TD{
border-style: none;
border-width: 0;
padding-left: 20px;
}
.detailsHeader
{
background-color: #FEF268;
border: solid 1px green;
}

Here is tehe desfault.aspx code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!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">
<title>Default</title>
<link href="site.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="MainForm" runat="server">
<div id="header">
<div id="logo"></div>
<h1>Wrox United</h1>
</div>
<div id="sidebar">
<h3>Navigation</h3>
</div>
<div id="content">
<div class="itemContent">

this is the default</div>
</div>
<div id="footer">
<p class="left">
All images and content copyright &copy; Wrox Press and its subsudiaries 2009.
</p>
<p class="right">
Website Designed by
<a href="http://www.frogboxdesign.co.uk" title="croak">Frog Box Design</a>
</p>
</div>
</form>
<div>

</div>
</form>
</body>
</html>


Thanks again,
K.
 
Old April 8th, 2009, 05:06 PM
Authorized User
 
Join Date: Mar 2009
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Here is the source code from the browser when testing the default file... it tests out fine as well from VWD but not once uploaded.
http://webspace.westwood.edu/karenec...1/Default.aspx

It appears the same as the About page:
http://webspace.westwood.edu/karenec...ss1/About.aspx

There is one more reply on its way but is getting "approved".... but I only get the parse error when the "~/" appears before the site.master in this string:
<%@ Page Title="About" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="About.aspx.vb" Inherits="About" %>

If I remove that to be "./" or completely remove it, you can see the results at the above urls.

Here is the source view of the default.aspx from the browser when testing locally:

<!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><title>

</title><link href="site.css" rel="stylesheet" type="text/css" /></head>
<body>
<form name="MainForm" method="post" action="Default.aspx" id="MainForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTIwNjAyODU4M2RkyviYzxm3Qd31ff6r0OfQ377H5OI =" />
</div>

<div id="header">
<div id="logo"></div>
<h1>Wrox United</h1>
</div>
<div id="sidebar">
<h3>Navigation</h3>
</div>
<div id="content">
<div class="itemContent">

this is the default</div>
</div>
<div id="footer">
<p class="left">
All images and content copyright &copy; Wrox Press and its subsudiaries 2009.
</p>
<p class="right">
Website Designed by
<a href="http://www.frogboxdesign.co.uk" title="croak">Frog Box Design</a>
</p>
</div>
</form>
<div>

</div>
</form>
</body>
</html>

Last edited by kippy; April 8th, 2009 at 05:19 PM..
 
Old April 8th, 2009, 05:18 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

If site.css is in fact in the same directory as this file, there is no reason I can think of that this page wouldn't be picking it up.

Can you absolutely assure that site.css is on your server? Filename typo or something maybe?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old April 8th, 2009, 05:29 PM
Authorized User
 
Join Date: Mar 2009
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Lee,

Yes, I am 1 million % sure that the site.css is on the school server...if you look at the above urls that I added in, you can see that it is pulling some information from the site master, but not the text formatting, or the images from the css... the words "Wrox United", "Navigation" and the " All images and content copyright © Wrox Press and its subsudiaries 2009. Website Designed by Frog Box Design" all reside on the site master page... so it pulls thru some info fromt eh site master.... but not the css styles and rules. But feel free to look for yourself...

http://webspace.westwood.edu/karenec.../Ass1/site.css


Please be aware also that I upload these files using Dreamweaver CS3....I can see the file structure of the webspace I upload to, and the site.css appears in the corrrect place. (Don't ask me why we use DW to upload, the answer resides with the same reason we are using 2.0 books for VWD 2008 program. )





Thanks again,


K.
 
Old April 8th, 2009, 05:42 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Thank you, that explains it exactly.

I can see that you have uploaded site.css as binary. There is all kinds of binary stuffed in there.

Change the FTP settings in DW so that .css files are transmitted as text, NOT binary. Then, re-upload site.css and you should be cool.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old April 8th, 2009, 05:50 PM
Authorized User
 
Join Date: Mar 2009
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Wow, I am impressed...but...would you know how I go about doing that exactly? I see nothing that references css in the site manager.

Thanks,
K.





Similar Threads
Thread Thread Starter Forum Replies Last Post
My GridView does not display in the content area of my master page? dotnetDeveloper ASP.NET 3.5 Basics 1 March 14th, 2009 02:42 PM
Master Pages, Content Pages and CSS carliviris Visual Studio 2005 0 January 8th, 2008 05:56 PM
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
Master Pages: Overriding header content sankerbrand ASP.NET 2.0 Basics 2 July 24th, 2006 12:16 PM





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