 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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
|
|
|
|
|

April 21st, 2012, 03:59 PM
|
|
Authorized User
|
|
Join Date: Apr 2012
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Master Page
Master Page
Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Frontend.master.cs" Inherits="MasterPage_Frontend" %>
<!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></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<link href="../Styles/Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div id="PageWrapper">
<div id="Header"><a href = "~/" runat="server">Header goes here</a></div>
<div id="MenuWrapper">Menu Goes Here</div>
<div id="MainContent">
<asp:ContentPlaceHolder ID="cpMainContent" runat="server">
</asp:ContentPlaceHolder>
<div id="Sidebar">Sidebar Goes Here</div>
<div id="Footer">Footer Goes Here</div>
</div>
</form>
</body>
</html>
Css file
Code:
#Header
{
background-color: #C0C0C0;
width: 844px;
height: 86px;
}
*
{
font-family: Arial;
}
h1
{
font-size: 20px;
}
.Introduction
{
font-style: italic;
color: #003399;
}
#PageWrapper
{
width: 844px;
}
#MenuWrapper
{
width: 844px;
}
#MainContent
{
width: 664px;
float: left;
}
#Sidebar
{
background-color: Gray;
width: 180px;
float: left;
}
#Footer
{
background-color: #C0C0C0;
width: 844px;
clear: both;
}
#MainContent a
{
color: #008000;
text-decoration: underline;
}
#MainContent a:visited
{
color: #FF0000;
text-decoration: underline;
}
#MainContent a:hover
{
color: #FFA500;
text-decoration: underline;
}
h1
{
padding: 0px;
margin: 0px 0px 10px 0px;
}
Sir this is the code of my css file and master page.Now please tell me why my sidebar does not aligned on right and it comes above the footer?
Thanks
|
|

April 21st, 2012, 04:22 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Your MainContent div is missing its closing </div> tag.
Cheers,
Imar
|
|

May 14th, 2012, 05:50 PM
|
|
Authorized User
|
|
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Almost the same problem
My MainContent has the closing div. My sidebar behaves the same as the origional poster's in design view, but displays correctly when i view it in the browser. Any idea why? thanks!
|
|

May 15th, 2012, 02:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Can you post the code for the master page? Also, is your CSS file stored in the correct folder and does it contain the proper CSS code?
Imar
|
|

May 15th, 2012, 09:20 AM
|
|
Authorized User
|
|
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Imar,
The Style sheet is in the Styles filder. I believe the page is finding it, as the formatting is applied in the browser and (for the most part) in design view.
thanks. s.
Code:
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<link href="../Styles/Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div id="PageWrapper">
<div id="Header"><a href="~/" runat="server">Header goes Here</a>="</div>
<div id="MenuWrapper">Menu Goes Here</div>
<div id="Maincontent">
<asp:ContentPlaceHolder id="cpMainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="Sidebar">Sidebar Goes Here</div>
<div id="footer">Footer Goes Here</div>
</div>
</form>
</body>
Code:
#Header
{
background-color: #C0C0C0;
width: 844px;
height: 86px;
}
*
{
font-family: Arial;
}
h1
{
font-size: 20px;
}
.Introduction
{
font-style: italic;
color: #003399;
}
#PageWrapper
{
width: 844px;
}
#MenuWrapper
{
width: 844px;
}
#MainContent
{
width: 664px;
float: Left;
}
#Sidebar
{
background-color: #808080;
width: 180px;
float: Left;
}
#Footer
{
background-color: #C0C0C0;
width: 844px;
clear: both;
}
#MainContent a
{
color: #008000;
text-decoration: underline;
}
#MainContent a:visited
{
color: #FF0000;
text-decoration: underline;
}
#MainContent a:hover
{
color: #FFA500;
text-decoration: underline;
}
h1
{
margin: 0px 0px 10px 0px;
padding: 0px;
}
|
|

May 15th, 2012, 10:04 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
When I run your code, the page doesn't look in Design View nor in the browser. Which browser did you test this on? I had to make the following changes to the master page:
1. Change Maincontent to MainContent (the CSS selector uses MainContent with a capital C)
2. Change footer to Footer
With these changes, the page looked OK in Design View and in the browser.
Hope this helps.
Imar
|
|

May 15th, 2012, 11:04 AM
|
|
Authorized User
|
|
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
IE9. I would attach pics, but not sure if it is possible. I will try your suggestions. s.
|
|

May 15th, 2012, 11:10 AM
|
|
Authorized User
|
|
Join Date: May 2012
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Imar, Sugesstions worked. "Design" now looks same as in the browser. Thanks. I'll watch my case closer from now on. BTW, you book rocks! Fantastic resource.
|
|

May 17th, 2012, 11:25 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
BTW, you book rocks! Fantastic resource.
|
Thank you!
Imar
|
|
 |
|