Design and CSS styles
Version 5.x > Design and CSS styles > CMS ListMenu question View modes: 
User avatar
Member
Member
hemanthray-gmail - 7/1/2011 2:07:10 PM
   
CMS ListMenu question
We have to change the CSS class name for the first ul tag of the menu's output html how can we do that

here is the script which is generated from the menu control can we change this class name to any custom name? CMSListMenuUL to cusutomcssclass
<ul class="CMSListMenuUL" id="menuElem">

<li class="CMSListMenuLI"><a href="/about/about.aspx" class="CMSListMenuLink">About</a>
<ul class="CMSListMenuUL">
<li class="CMSListMenuLI"><a href="/About/Contact-Us.aspx" class="CMSListMenuLink">Contact Us</a></li>

</ul>
</li>
<li class="CMSListMenuLI"><a href="/Events.aspx" class="CMSListMenuLink">Events</a>
<ul class="CMSListMenuUL">
<li class="CMSListMenuLI"><a href="/Events/Chapter-Events.aspx" class="CMSListMenuLink">Chapter Events</a></li>
</ul>
</li>
</ul>

User avatar
Kentico Support
Kentico Support
kentico_radekm - 7/1/2011 2:30:33 PM
   
RE:CMS ListMenu question
Hello.

You may need to modify the CSS List Menu web part. It has a property called RenderedHTML. It returns whole HTML that is rendered by the web part. You may need to parse this string and add the class where you need. You can find a description on how to modify an existing web part in our Developer's guide. Please find a link below.
http://devnet.kentico.com/docs/devguide/index..html?modifying_the_code_of_standard_web_parts.htm

Best Regards,
Radek Macalik

User avatar
Member
Member
hemanthray-gmail - 7/2/2011 11:50:06 AM
   
RE:CMS ListMenu question
Thanks got it

User avatar
Member
Member
Peter.Solnet-gmail - 1/24/2014 3:41:39 AM
   
RE:CMS ListMenu question
Hi, I have a exact issue with ListMenu as the question above but the link you provided is a 404 page. Can you assist with an explanation on how to get this resolved?

User avatar
Kentico Support
Kentico Support
kentico_radekm - 1/24/2014 7:06:37 AM
   
RE:CMS ListMenu question
Hello.

There are two dots in URL. Please remove one of them or use the following URL: http://devnet.kentico.com/docs/devguide/index.html?modifying_the_code_of_standard_web_parts.htm

Does it help?

Best Regards,
Radek Macalik

User avatar
Member
Member
Peter.Solnet-gmail - 1/24/2014 7:17:07 AM
   
RE:CMS ListMenu question
That did't help.

I checked the code behind of the cmslistmenu and edited the the OnContentLoaded() method to look like this:
    public override void OnContentLoaded()
{
base.OnContentLoaded();
this.menuElem.RenderedHTML = this.menuElem.RenderedHTML.Replace("<ul class='CMSListMenuUL' id='main_menu'>", "<ul class='sm sm-blue' id='main_menu'>");
SetupControl();

}

but still no result as expected. What do you think I am missing?

User avatar
Kentico Support
Kentico Support
kentico_radekm - 2/12/2014 6:52:33 AM
   
RE:CMS ListMenu question
Hello.

Could you please modify it in the OnLoad event instead? Thank you.

Best Regards,
Radek Macalik