ASPX templates
Version 5.x > ASPX templates > CMSListMenu drops Menu Item CSS Class View modes: 
User avatar
Member
Member
imuir-piehead - 2/10/2011 2:38:01 PM
   
CMSListMenu drops Menu Item CSS Class
I'm currently using the CMSListMenu control to render my site's navigation.

I'm using the Menu Item CSS Class to set a background image and width for each of the nav items. Unfortunately, the Menu Item CSS Class is not present when an item is the highlighted item.

For example, normally, my link would render as:

<li class="myMenuItemCssClass"><a href="url to page">Page Name</a></li>

When the link is the current item, it renders the following instead:

<li class="CMSListMenuHighlightedLI"><a href="url to page">Page Name</a></li>

Essentially, the highlighted class replaces my class, rather than appending to it.

Is there anyway to force the List Menu to always use my class?

User avatar
Certified Developer 8
Certified Developer 8
dvanbale - 2/19/2011 1:18:37 PM
   
RE:CMSListMenu drops Menu Item CSS Class
Hello Imuir,

I've looked at the CMSListMenu item code and the MenuHighlightedLI value is hardcoded as the CssClass for the li item, it does however change the value according to any CssPrefix you can provide in the "CSSPrefix" property.

Personally when I implement a CMSListMenu, I don't try and change the CMSListMenu to work with my stylesheet definition but rather adapt my class names to the default classes that the CMSListMenu provides.

If this is not possible, perhaps you could write your own custom menu control.

If you have any other questions, please let us know!

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 2/21/2011 3:03:17 AM
   
RE:CMSListMenu drops Menu Item CSS Class
Hello,

Dvanbale is right. The active item class is always overwritten. However, you can take advantage of defining Menu item CSS class property within Menu item design - highlighted section on Menu tab. This way, you can define whatever class for highlighted li element.

Best regards
Ondrej Vasil

User avatar
Member
Member
Ian Muir - 2/22/2011 8:49:13 AM
   
RE:CMSListMenu drops Menu Item CSS Class
This would be a good thing to add to the bug list.

For many CSS menus, the first level nav items might have different background images or different widths set via CSS. Since my CSS classes are being overwritten, it makes the CMSListMenu completely useless for our company.

I would expect that it would just append the highlighted class, not replace the existing class.

User avatar
Certified Developer 8
Certified Developer 8
dvanbale - 2/22/2011 1:27:18 PM
   
RE:CMSListMenu drops Menu Item CSS Class
Hello Ian,

The CMSListMenu has the FirstItemCssClass and LastItemCssClass property, would that remedy your problem?

User avatar
Member
Member
DahlinDev - 6/28/2013 12:01:15 PM
   
RE:CMSListMenu drops Menu Item CSS Class
I found a solution.

on the properties tab of the page if you go to the Navigation there is Menu Item Design Highlighted. You can enter your classes in here so not overwritten with just Highlighted class.

User image

User avatar
Kentico Support
Kentico Support
kentico_janh - 7/1/2013 8:31:45 AM
   
RE:CMSListMenu drops Menu Item CSS Class
Hello,

Yes, however this is available only from version 6 on.

Best regards,
Jan Hermann