Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 19th, 2011, 03:34 PM
Registered User
 
Join Date: Sep 2008
Location: Phoenix, AZ, .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default CH6 - master page not applying css correctly

Hello,
I'm going through CH6 and have created the master page and assigned the styles.css. When I view the master page in design view the sidebar is not going to the side as shown on figure 6-2 on page 201 when viewing frontend.master in design view. The css works fine on the default.aspx example. The sidebar is appearing underneath the menu. Any suggestions?

Here is a portion of css:
#MainContent
{
width: 664px;
float: left;
}
#Sidebar
{
background-color: #C0C0C0;
width: 180px;
float: left;
}

CODE for masterpage
<%@MasterLanguage="VB"CodeFile="Frontend.master.vb"Inherits="MasterPages_FrontEnd" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<
headrunat="server">
<title></title>
<asp:ContentPlaceHolderid="head"runat="server">
</asp:ContentPlaceHolder>
<linkhref="../Styles/styles.css"rel="stylesheet"type="text/css"/>
</
head>
<
body>
<formid="form1"runat="server">
<divid="PageWrapper">
<divid="Header"><ahref="~/"runat="server">Header Goes Here</a></div>
<divid="MenuWrapper">Menu Goes Here</div>
<divid="MainContent">
<asp:ContentPlaceHolderID="cpMainContent"runat="server">
</asp:ContentPlaceHolder><divid="Sidebar">Sidebar Goes Here</div><divid="Footer">Footer Goes Here</div></div>
</form>
</
body>
</
html>
Reply With Quote
  #2 (permalink)  
Old May 19th, 2011, 04:01 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Is the Design View in VS wide enough to show the page?

If it is, can you repost the code but paste it in Notepad first to remove color coding and then use the Code button on the editor's toolbar (on a post) to wrap it in Code tags? Due to some bug in this forum, colored code ends up as unusable...

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Last edited by Imar; May 19th, 2011 at 04:35 PM..
Reply With Quote
  #3 (permalink)  
Old May 19th, 2011, 04:21 PM
Registered User
 
Join Date: Sep 2008
Location: Phoenix, AZ, .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply! The display is wide enough. Look forward to your response.

Frontend.master
Code:
 
<%@ Master Language="VB" CodeFile="Frontend.master.vb" Inherits="MasterPages_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>
styles.css
Code:
 
#Header
{
    background-color: #C0C0C0;
    width: 844px;
    height: 86px;
}
*
{
    font-family: Arial;
}
h1
{
    font-size: 20px;
}
.Introduction
        {
            font-style: italic;
            color: #0000FF;
        }
#PageWrapper
{
    width: 844px;
}
#MenuWrapper
{
    width: 844px;
}
#MainContent
{
    width: 664px;
    float: left;
}
#Sidebar
{
    background-color: #C0C0C0;
    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 0px 10px 0px;
}
Reply With Quote
  #4 (permalink)  
Old May 19th, 2011, 04:34 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi mikeal,

You have a missing </div> between </asp:ContentPlaceholder> and the opening <div /> for the Sidebar.

You may see that issue appear as a warning in the Error List which may help track down future issues like this.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old May 19th, 2011, 04:41 PM
Registered User
 
Join Date: Sep 2008
Location: Phoenix, AZ, .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you! I keep looking at code and did not see it... At least now I'll never forget to use the Error List, thanks for the advice.

Regards,
Mike
Reply With Quote
Reply


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
Can't see web part properties after applying a custom fixed width master page Dan.Hudson BOOK: Professional SharePoint 2010 Branding and User Interface Design 2 May 12th, 2011 02:58 PM
Creating a Master Page and Importing a CSS rubends BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 6 March 14th, 2008 03:56 AM
Add dynamic css to master/content page proj-How? VictorVictor ASP.NET 2.0 Basics 6 June 9th, 2006 12:09 PM
Creating a Master Page and Importing a CSS rubends BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 April 19th, 2006 03:43 PM
Applying CSS to tables andyhague CSS Cascading Style Sheets 4 April 5th, 2006 05:30 AM



All times are GMT -4. The time now is 04:13 AM.


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