Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
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 July 5th, 2011, 11:00 AM
Registered User
 
Join Date: Sep 2010
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem in assigning css class in each items of navigation menu of web.sitemap file

Hi,Imar
First thanx for writing this wonderful book. I have a problem in assigning css property for each menu items. Though its not mentioned on the book. But I need to assign css property.The website.map have following code.

<?xml version=”1.0” encoding=”utf-8” ?>
<siteMap xmlns=”http://schemas.microsoft.com/AspNet/SiteMap-File-1.0”>
<siteMapNode url=”~/” title=”Home” description=”Go to the homepage”>
<siteMapNode url=”~/Reviews” title=”Reviews”
description=”Reviews published on this site” />
<siteMapNode url=”~/About” title=”About”
description=”About this site” />
</siteMapNode>
</siteMap>

What shall I do to make the home appear as red, Review-blue, About-green by assigning the individual class to home ,review& about.
Thanx for the zillion imar.
 
Old July 6th, 2011, 04: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

Quote:
First thanx for writing this wonderful book.
Thank you!

Unfortunately, this is not going to be easy. You can't add a CSS class to each item programmatically. You can use a work around as explained here:

http://forums.asp.net/t/1635691.aspx/1

Alternatively, you could jQuery to do it client side. With jQuery it's easy to address the first, second, n-th and so on element in the menu and assign a new CSS class.

Hope this helps,

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 July 6th, 2011, 09:39 AM
Registered User
 
Join Date: Sep 2010
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
Unfortunately, this is not going to be easy. You can't add a CSS class to each item programmatically. You can use a work around as explained here:

http://forums.asp.net/t/1635691.aspx/1
Thank you for the reply but I guess I have mistaken to ask the question . The link shows for the styling the child menu. I meant styling the parent menu's home, review, about
 
Old July 6th, 2011, 09:57 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:
The link shows for the styling the child menu.
No, it doesn't. It shows how to customize the main menu items.

Did you try it out?

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 July 6th, 2011, 08:39 PM
Registered User
 
Join Date: Sep 2010
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
No, it doesn't. It shows how to customize the main menu items.
Did you try it out?

Imar
No, I didn't but I will now..thanx Imar.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 7 Menu tool of navigation css style problem lixintong ASP.NET 3.5 Basics 1 July 10th, 2009 05:02 AM
Problem with Menu Control for Navigation Bear2009 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 February 10th, 2009 05:32 PM
Problem with Web.sitemap? Dmitriy ASP.NET 3.5 Professionals 0 October 14th, 2008 07:14 AM
SiteMap Navigation question Quick209 ASP.NET 2.0 Professional 5 August 30th, 2006 12:44 AM
sitemap and navigation help -Dman100- ASP.NET 2.0 Basics 0 July 17th, 2006 10:28 PM





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