Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : 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 March 29th, 2013, 04:45 PM
Registered User
 
Join Date: Feb 2011
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Default Menu - ItemWrap

I'm on chapter 7 of the book and it made me think of a problem I am having. I want to be able to wrap text for long sub-menu titles. I tried setting the ItemWrap property of the menu to True. When I look at this property in MSDN help it seems to be just what I'm looking for, but changing the setting seems to have no affect. What am I missing? Is there a difference between how this property acts regarding vertical vs. horizontal orientation?
 
Old March 30th, 2013, 10:05 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 there,

Not sure why ItemWrap doesn't work correctly in a plain version of the menu control. However, you probably shouldn't use it as it - if I am not mistaken - renders outdated HTML.

Instead, make sure that IncludeStyleBlock is set to False, and then handle the CSS yourself. By setting the width of a menu item to, say 150px like this:
Code:
.level 1 a { width: 150px; }
text wrapping will occur automatically.

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!
The Following User Says Thank You to Imar For This Useful Post:
d2drake@gmail.com (March 31st, 2013)
 
Old March 31st, 2013, 01:56 PM
Registered User
 
Join Date: Feb 2011
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Default ItemWrap

Thanks for the quick reply Imar. I must be doing something wrong. When I turn off IncludeStyleBlock it had no affect. So while it was still off I tried setting ItemWrap to True. It DID wrap but everything else was messed up, like I now had bullets and dynamic items we displayed as bullet items beneath their static heads.

I switched everything back and was looking at the "Inspect Element" feature in Chrome and discovered that there is a command being added somewhere along the process: white-space: no-wrap. So I put the following command in:

.dynamic a { white-space: normal !important; }

and it's working now.

Any comments on the wisdom of this would be appreciated.

Doug
 
Old April 2nd, 2013, 04:38 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
was looking at the "Inspect Element" feature in Chrome and discovered that there is a command being added somewhere along the process: white-space: no-wrap.
That sounds like ItemWrap was off, rather that on?

I am not exactly sure what happened. A lot of the generated code depends on many factors: the actual framework on your machine (probably .NET 4.5), the framework you're targeting in web.config (probably .NET 4.5 but it could be 4), and the browser and its version. ASP.NET renders different markup for different browsers (uplevel or downlevel browsers) and also renders differently based on the various .NET Framework versios and settings.

Code:
dynamic a { white-space: normal !important; }
The !important overrides whatever was set elsewhere, so if you can't get rid of the white-space: no-wrap elsewhere, this seems like a good fix to me.

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!
The Following User Says Thank You to Imar For This Useful Post:
d2drake@gmail.com (April 2nd, 2013)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 7 Menu exercise - Menu only Appearing in DarkGrey theme WHixson BOOK: Beginning ASP.NET 4 : in C# and VB 1 April 19th, 2011 12:11 PM
CH 15 Context Menu - Element Menu Items Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 November 9th, 2008 03:53 PM
how create menubar, menu, menu item in xsl vijayanmsc XSLT 1 June 5th, 2006 06:43 AM
right click menu hidden by drop-drown menu Andraw HTML Code Clinic 0 March 18th, 2005 03:28 PM
Changing Menu made with VB 4 Menu Editor Zooker VB How-To 1 July 26th, 2003 11:44 PM





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