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 June 22nd, 2011, 02:42 AM
Registered User
 
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7 Hover problems.

I have completed the styling menu controls exercise and nothing is happening when I hover over the menu. all the rest of the styles, ie background color, are fine. Just nothing is changing while hovering.

Here is my masterpage code:
Code:
    <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>
And here is the Monochrome.css code for these classes:
Code:
.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;
}
Any help in solving this would be greatly appreciated.

Ps, doesn't work in either firefox or IE

Thanks!
Bryan.
 
Old June 22nd, 2011, 05:37 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Bryan,

I copied and pasted your code into my project and it works as expected, except for the padding. You have this:

Code:
 
padding: 4px, 2px, 4px, 3px;
while it should be

Code:
 
padding: 4px 2px 4px 3px;
Howver, that affects padding only and not the hovering.

Maybe you're looking at a cached copy of the page? try reloading the page with Ctrl+F5.

Do the menus fold out correctly when you hover? In other words, is the problem in the hovering color only? In the latter case, is there other CSS in the theme file that could override your settings?

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 June 22nd, 2011, 11:19 AM
Registered User
 
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I changed the padding. I tried reloading the page like you've suggested and it doesn't work. Yes, the sub-menu items do drop out they just don't change color on hover. My css file was copied directly from the resources file only thing being added is what I showed in the first post. I just don't get it. everything looks like it should work, but it doesn't!
 
Old June 22nd, 2011, 02:59 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you send me a zipped copy of the website so I can take a look?

You can send me a message through my web site (see link in my signature). I'll then reply so you know my e-mail address.

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 June 22nd, 2011, 08:15 PM
Registered User
 
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Message sent. thanks!
 
Old June 24th, 2011, 05:35 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, I see.

You're following the 3.5 book / code with a VS 2010 / .NET 4 project. While most of it will work, you will run in some issues when it comes to control rendering. The .NET 4 menu renders completely different code than its predecessor, breaking the CSS you add to the theme to style the menu.

Take a look at this thread for suggestions on how to fix this:

Spacing menu options across menu bar

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 June 24th, 2011, 09:45 AM
Registered User
 
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That worked great thanks. But what code would I have to do differently for it to work with 4.0 ? If that's not too complicated to answer here.
 
Old June 24th, 2011, 01:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You could download the source code for the 4.0 version of the book. A lot is pretty similar (the Master Page for example), so hopefully it's easy to spot the differences in CSS. You can also check out the live site at www.planetwrox.com.

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 June 25th, 2011, 12:34 PM
Registered User
 
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Awesome. thanks so much for your help. Have a great weekend!

Bryan
 
Old June 26th, 2011, 03:36 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're welcome, and you too.

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
a:hover AlexW CSS Cascading Style Sheets 4 February 27th, 2011 10:03 AM
problems with getting Front Page 98’s hover button melon Access 0 July 6th, 2006 02:38 AM
ie vs. firefox menu/hover/width problems mishagos BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 June 29th, 2006 08:02 AM
a:hover problems Stevie CSS Cascading Style Sheets 4 May 8th, 2005 04:30 PM





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