Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 26th, 2011, 08:20 AM
Registered User
 
Join Date: Apr 2011
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Spacing menu options across menu bar

Hi,

I have worked through "Beginning ASP.NET 3.5 In C# and VB" and am now using the skills I learned to create a website of my own.

The theme of my layout is based on the Monochrome theme from the book. However I am having trouble with the menu. Currently the menu links are all appearing toward the left of the menu bar. I would like to have them evenly spaced across the menu bar like in the Planet Wrox Site. As far as I can see I have created my menu is a similar way. Can anybody suggest what I ma be missing or how I can resolve this?

Cheers
Paul
 
Old April 26th, 2011, 08:43 AM
Registered User
 
Join Date: Apr 2011
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

By the way, here is my master page and css file:

Code:
<%@ Master Language="VB" AutoEventWireup="false" CodeFile="Site.Master.vb" Inherits="Site" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
        <div id="PageWrapper">
            <div id="Header"><a class="HeaderLink" href="~/" runat="server"></a></div>
            <div id="MenuWrapper">
                <asp:Menu ID="Menu1" runat="server" CssClass="MainMenu" DataSourceID="SiteMapDataSource1" 
                    Orientation="Horizontal" StaticEnableDefaultPopOutImage="False">
                    <DynamicHoverStyle CssClass="DynamicHoverStyle" />
                    <DynamicMenuItemStyle CssClass="DynamicMenuItemStyle" />
                    <StaticHoverStyle CssClass="StaticHoverStyle" />
                    <StaticMenuItemStyle CssClass="StaticMenuItemStyle" />
                    <StaticSelectedStyle CssClass="StaticSelectedStyle" />
                </asp:Menu>
                <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" 
                    ShowStartingNode="False" />
            </div>
            <div id="Main">
                <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
            </div>
            <div id="Sidebar"></div>
            <div id="Footer">Footer goes here</div>
        </div>
    </form>
</body>
</html>
Code:
*
{
	font-family: Arial, Sans-Serif;
}

body
{
	/* 
		Clears white space around the body except for the top which gets 10 pixels.
	*/
	margin: 10px 0 0 0;
}

a
{
	/*
		Clears the underline on normal links, and give them #308462 as the color.
	*/
	color: #308462;
	text-decoration: none;
}

a:hover
{
	/*
		Underlines links when the users hover the mouse over them.
	*/
	text-decoration: underline;
}

h1
{
  /*
    Makes h1 elements smaller than their browser default.
  */
 font-size : 20px;
}

.Introduction
{
  font-style: italic;
  color: #003399;
}

#PageWrapper
{
	/*
		Sets the total width for the entire page. 
	*/
	width: 844px;
	background-color: #cccccc;
	margin: auto
}

#Header
{
	/*
		Gives the header the same width as the PageWrapper. The height creates some room for the logo
		that is set with the background-image.
	*/
	background-image: url(Images/Header.jpg);
	width: 844px;
	height: 86px;
}

.HeaderLink
{
	/*
		The #HeaderLink is nested in the #Header. It provides a link to the homepage.
	*/
	width: 844px; 
	height: 86px; 
	display: block;	
}

#MenuWrapper
{
	/*
		The menu spans the page width, right below the header.
		At the top and left a few pixels padding is applied to create some room.
	*/
	background-image: url(Images/MenuBackground.jpg);
	width: 827px;
	height: 36px;
	padding-top: 7px;
	padding-left: 17px;
}

#MenuWrapper a
{
	/*
		Links in the Menu are white. This gets overriden by styles in chapter 7.
	*/
  color: #fff;
}

.MainMenu
{
	/*
		The Menu gets a white border on all four sides.
	*/
	border: 1px solid white;
	width: 814px;
	height: 19px;
	background-color : #cccccc;
}

#Main
{
	/*
		Defines the main content area. The #MainContent element has a minimum height of 500 pixels, but can grow if necessary.
		The font-size is 80% of its parenty element, which in this case comes down to 80% of the font
		the user has specified as the default font in the browser.
	*/
	font-size: 0.8em;
	width: 659px;
	border-left: 1px solid white;
	border-right: 2px solid white;
	float: left;
	background-color: #e1e1e1;
	min-height: 500px;
	padding: 10px;
}

#Sidebar
{
	/*
		The SideBar is positioned to the right of the MainContent area. It gets the same font-size as #MainContent
		and gets a background image called Sidebar.jpg. To ensure the image is visible in (most) browsers
		on a small page, the element gets a minimum height of 500px. This is ignored by IE 6.
	*/
	font-size: 0.8em;
	background-image: url(Images/Sidebar.jpg);
	background-repeat: no-repeat;
	background-color: #cccccc;
	width: 152px;
	min-height: 500px;
	padding-top: 10px;
	padding-left: 10px;
	float: left;
}

#Footer
{
	/*
		The footer is positioned below all other content (yet still within PageWrapper).
		At the top, it gets a border with a dashed style, while all other sides have no border.
		clear: both is used to clear the impact of the float properties used for #MainContent and #SideBar.
	*/
	clear: both;
	height: 37px;
	background-color : #bee4cf;
	color: White;
	text-align: center;
	font-size: 0.7em;
	font-weight: bold;
	line-height: 37px;
}

.MyButton
{
    color: #308462;
}

.StaticMenuItemStyle, .StaticMenuItemStyle a
{
    color: #707070;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    padding-left: 2px;
}

.StaticHoverStyle, .StaticSelectedStyle
{
    background-color: #c1e4ce;
}

.DynamicMenuItemStyle
{
    font-size: 14px;
    color: #707070;
    background-color: #cccccc;
    padding: 4px 2px 4px 3px;
}

.DynamicHoverStyle
{
    background-color: #707070;
    color: White;
}

.DynamicHoverStyle a
{
    text-decoration: none;
} 

.PleaseWait
{
    height: 32px;
    width: 500px;
    background-image: url(Images/PleaseWait.gif);
    background-repeat: no-repeat;
    padding-left: 40px;
    line-height: 32px;
}
 
Old April 26th, 2011, 01:27 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Are you using VWD 2010 and .NET 4? if so, some of the 3.5 code is not compatible. The Menu in ASP.NET 4 renders differently than it did previously. A few ways to fix:

1. Modify the CSS to match the new rendered HTML (<ul> and <li> elements instead of tables)

2. Add the following to your web.config:

Code:
 
<pages theme="Monochrome" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
The latter option affects more controls, so make sure things look the way you want if you apply this fix.

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!
 
Old April 27th, 2011, 10:30 AM
Registered User
 
Join Date: Apr 2011
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Cheers. that has helped. The links are a little out of position now but I'll get that sorted.

I was using VWD2010. Would I be correct in thinking I may have selected .NET 3.5 at some point when I began working through the exercises in your book?

Its an excellent book by the way!

Cheers
Paul
 
Old April 27th, 2011, 10:59 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It's the other way around. You have a VWD 2010 / .NET 4 project, and try to use it with code (from my book) targeted at .NET 3.5

By adding that switch to the web.config, you tell the .NET 4 project to render in 3.5 mode, making it compliant with my / your 3.5 code.

Hope this helps,

Quote:
Its an excellent book by the way!
Thanks!

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
menu bar used in this site..!! krissh ASP.NET 2.0 Basics 4 August 4th, 2008 12:09 AM
Secure menu options MythicalMe BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 May 25th, 2006 12:20 PM
How do disable Menu bar & address bar for browser bekim HTML Code Clinic 2 January 7th, 2005 12:33 AM
List/Menu Box Options From a Text File phungleon Classic ASP Professional 4 April 23rd, 2004 11:49 AM
accessing sub menu options mookashi Pro VB 6 0 March 2nd, 2004 07:37 AM





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