Wrox Programmer Forums
|
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
 
Old December 9th, 2012, 09:22 PM
Registered User
 
Join Date: May 2012
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default Menu control bug?

Hi Imar,

Following your book, I have created a website but there seems to be an issue with the site menu bar when the website loads in the browser. I have used an asp.net menu control set to horizontal, but when the page loads the menu and sub menu appears vertical, briefly for a second before displaying horizontally. The menu control also uses a sitemap data source control.

This is the website://www.wykeham-gallery.co.uk

This is my menu control code in the Master Page:

<div class="MenuWrapper">
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal" StaticEnableDefaultPopOutImage="False" CssClass="MainMenu" SkipLinkText="">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="False" />
</div>


This is my CSS styles for the menu:

.MenuWrapper
{

clear: both;
background-color: #808040;
width: 960px;
height: 21px;
border-bottom: 3px solid #CCCCCC;
padding-top: 2px;
padding-left: 0px;
margin: 19px 0px -5px 0px;
}

#MenuWrapper a
{
/*
Links in the Menu are white.
*/
color: #fff;

}

.MainMenu
{

border: 0px solid red;
height: 19px;
background-color: #808040;
padding: 0px 0px 1px 0px;
margin: 0px 0px 0px 25px;

}

.MainMenu ul li
{
/*
Gives the seven menu items in the main menu an auto width each
*/
width: auto;

}





ul.level1
{
/* Defines the appearance of main menu items. */

background-color: #808040;
font-size: 14px;
font-weight: normal;
height: 19px;
line-height: 19px;
border: 0px solid purple;
margin: 2px 0px 2px 0px;
text-align: left;
}

ul.level1 .selected
{
/* Defines the appearance of active menu items */
background-color: #808040;


}

a.level1
{
/* Adds some white space to the left of the main menu item text */

margin-left: 55px;
color: #FFFFFF;



}

a.level2
{
/* Defines the appearance of the sub menu items */
background-color: #808040;
padding-top: 0px;
padding-right: 8px;
padding-bottom: 3px;
padding-left: 8px;
margin-top: 5px;
margin-left: 55px;
margin-bottom: 5px;
color: #FFFFFF;
border-bottom-style: solid;
border-bottom-color: #C0C0C0;
font-size: 14px;


}

a.level1:hover, a.level2:hover
{
/* Defines the hover style for the main and sub menu items */
background-color: #9D9D4F;

}

Do you know what the problem could be?

Many Thanks
 
Old December 10th, 2012, 07:21 AM
Authorized User
 
Join Date: Nov 2012
Posts: 40
Thanks: 8
Thanked 5 Times in 4 Posts
Default

Hi Chris,

This happens because of the way menu is handled in asp.net. Prior to ASP.NET 4 the menu was rendered as table but with .NET4 the default mode is ul.
The same has been mentioned in the book too under "rendering mode" heading.

Now your problem,

To my thinking try tweaking with the ul css property, try

.MainMenu ul li ul{ display: none;}

Last edited by 07Raghav; December 10th, 2012 at 07:37 AM..
 
Old December 12th, 2012, 01:29 AM
Registered User
 
Join Date: May 2012
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default Menu Control bug?

Hi 07Raghav,

Thank you for your response on this. I have tweeked the ul css property like you said, and the menu bar seems to display properly which is great. However, the drop down sub menu items under the Framing link, tend to appear slightly stacked over each other and the background colour of each drop down menu item only displays the length of the actual wording in the link.

I don't suppose you have any ideas why?

Many Thanks,
 
Old December 12th, 2012, 03:05 AM
Authorized User
 
Join Date: Nov 2012
Posts: 40
Thanks: 8
Thanked 5 Times in 4 Posts
Default

Hello Chris,

Not sure, try this..
.MainMenu ul li{ position: relative; float: left; list-style: none;}

The main reason of approximation in solutions is not having the direct code, but try playing around the css, its gonna solve the situation.

ASP.NET4 uses(for default mode) ul & li to render menu items thereof you need to clearly define their properties.

Last edited by 07Raghav; December 14th, 2012 at 10:16 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Menu control kiwibrit BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 11 November 30th, 2009 04:11 PM
Winsock control bug ratheeshpkr VB Components 3 May 29th, 2007 04:46 AM
Bug or no to bug learning C using VS.Net to compil tesh All Other Wrox Books 0 February 14th, 2007 01:06 PM
Silly bug in Menu melvik C# 0 August 26th, 2003 07:29 AM
menu control annieapple VS.NET 2002/2003 1 August 6th, 2003 10:41 AM





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