Custom Menu

Sep 7, 2010 at 3:21 PM

Hello,

if I use Html.MvcSiteMap().Menu("active") to create a menu, then I will get:

<ul>
<li class="active"><a href="/" title="Text"><span>Text</span></a></li>

<li><a href="/" title="Text"><span>Text</span></a></li>

</ul>

 

What is the best way to provide custom "id" attributes in LI tags? I would like to have something like that:

<ul>
<li id="nav01" class="active"><a href="/" title="Text"><span>Text</span></a></li>

<li id="nav02"><a href="/" title="Text"><span>Text</span></a></li>

</ul>

 

Thanks,

Chris


Sep 8, 2010 at 9:40 AM

Hey Chris,

now we are already two supporters for this idea:

 

See

http://mvcsitemap.codeplex.com/Thread/View.aspx?ThreadId=226300

 

Kind Regards

Sven

Coordinator
Sep 9, 2010 at 5:50 PM

For now, I would say just copy the MenuHelper and implement your own logic. A node can contain custom attributes which you can use for that.

I'm planning on making the helpers more "fluent", where you can interfere in every step of the rendering process. Still thinking about a good API there though. Suggestions welcome :-)