Wrox Programmer Forums
|
BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9
This is the forum to discuss the Wrox book Professional ASP.NET 3.5: In C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470187579
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 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 January 22nd, 2010, 03:17 PM
Registered User
 
Join Date: Jan 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp:menu

Hi

I want to make a menu where the first level is invisible and only the second level shows (Sub levels will only show at mouseover as fly-out). I have tried for a long time now but I can|t seem to figure it out.

What to do what to do? Is it even possible to hide the first level?

(I'm using visual studio 2008.)

m
 
Old July 2nd, 2010, 02:20 PM
Authorized User
 
Join Date: Aug 2009
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Default

WHY?

If the first level of the menu is "invisible", then how is the user supposed to even access the 2nd level of the menu?
 
Old August 2nd, 2010, 01:49 AM
Registered User
 
Join Date: Aug 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ASP menu can be cumbersome to work with when you are trying to do special things like this- you might want to check out Obout Tools (www.Obout.com). They have some really cool tools (some of which are free) that can be loaded right into your VS2008 ToolBox. See their Obout "Easy Menu" and their "Flyout" tools.
 
Old August 3rd, 2010, 12:47 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Quote:
Originally Posted by mikaZk View Post
Hi

I want to make a menu where the first level is invisible and only the second level shows (Sub levels will only show at mouseover as fly-out). I have tried for a long time now but I can|t seem to figure it out.

What to do what to do? Is it even possible to hide the first level?

(I'm using visual studio 2008.)

m
I believe this isn't possible because of the limitations of CSS.

If you mean that you want the level one element to be invisible on the page, there is no way using CSS to trigger a child element inside it. If what you want is a context menu, you can use JS to insert new visible elements and place them wherever in the document you want; in fact jQuery is an excellent JS library for doing just that.

If what you want is to hide the first level as soon as it's triggered the second, the order of CSS can't pull that off in any way that I know of. The code for executing a drop down menu to reveal a second level item (navMenu) when you mouse over the first level (navButton) is...

Code:
/*  Toggle Menus On and Off  */

.navButton:hover .navMenu { 
display: block;
}
Here's what the selector specifically defines. When the mouse hovers over the navButton element grab the navMenu element; we can now set properties for the navMenu element and in this case I change the default display. Initially I've set it to none so that the menu element does not appear until someone mouses over it. Then I switch the display back to block so it appears.

However, note the order of the selector. This works because you can define a hover action on the parent element, navButton. This draws the focus of the CSS selector and most CSS is about styling that element. However, CSS allows you to continue to bore down and specify child elements of the current item and that's what we've done in this case. Once we've focused on navButton (but only when a mouse is hovering over it) we style the child element navMenu, and make it appear.

This can't work in reverse. If we specify the .navMenu:hover, we can only affect child elements after that. Not parent elements, so I believe that's where we're stuck.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
asp:menu issue Russel ASP.NET 2.0 Professional 2 December 4th, 2006 03:27 PM
asp:menu trouble Russel ASP.NET 2.0 Basics 0 December 4th, 2006 01:05 AM
Asp : Menu Control sofia ASP.NET 2.0 Professional 1 November 28th, 2006 06:19 PM
drop down menu in asp mateenmohd Classic ASP Basics 3 June 7th, 2003 02:43 PM





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