Full Dynamic Menu

Sep 1, 2010 at 5:28 AM

Hello and great job for the sitemap provider,

I want to create all the menu dynamically from the controllers using the attributes. I am getting Stack OverFlow errors every time I run the project. All I need is 5 menus with no children. How can I define that with attribute and without defining an xml file?


Sep 1, 2010 at 7:19 AM

Can you post the exact attributes you have declared?

Sep 1, 2010 at 7:25 AM

For example, if I have three pages: Home, About, Contact. Here's what I used:

[MvcSiteMapNodeAttribute(Title = "Home", Clickable = true, Description = "Home Page")]


Sep 1, 2010 at 8:59 AM

A "ParentKey" should be specified in all but one attribute. I suggest the home page will be the one without ParentKey.

Sep 1, 2010 at 3:40 PM

I had the parent key setup on all the pages except the home and i was still getting an error. I tried it today from work and it worked. For anyone who is having the issue, This is the attributes I used without defining any XML file:

[MvcSiteMapNode(Title = "Home", Description = "Home Page")]

[MvcSiteMapNode(Title = "Contact", ParentKey = "Home", Description = "Contact Page")]

[MvcSiteMapNode(Title = "About", ParentKey = "Home", Description = "About Page")]

Thanks again,