display full path of item hierarchy

Mar 16, 2011 at 8:54 AM

i am using a 3rd party control (telerik) to render a menu based on the mvcsitemap.

everything is fine but when i hover over the 3rd level item (see below - john smith) it shows me the following path:

aboutus/john-smith

but i would like it to show:

aboutus/team/john-smith

<mvcSiteMapNode title="About Us" controller="AboutUs" action="Index">       
<mvcSiteMapNode title="Team" action="team"> <mvcSiteMapNode title="John Smith" action="john-smith" /> </mvcSiteMapNode> </mvcSiteMapNode>
   
will that be possible (please note john smith and team are both views/actions under the "about us" controller)

Mar 24, 2011 at 3:52 PM

I've done something similar.  I found out that the Route Tables have an impact on how the nodes are displayed.

If you add a Route to include the team and name specifically (either in global.asax or an area registration) it should show properly.

Mar 28, 2011 at 10:40 PM

tomcdona are you able to provide an example for the route in the global.asax? i am having trouble with this

Mar 29, 2011 at 5:14 PM

I'd try something like this:

context.MapRoute(
	"AboutUs_Default",
	"{controller}/{action}/{user}",
	new { controller = "AboutUs", action = "team", user = "john-smith" }
);

Basically what this does is split the team action from the user action.  Currently in your map, you're assigning two different actions under the same controller.
Both the "Team" and "John Smith" entries are individual actions under the "AboutUs" controller.

Moving the "john-smith" to a different token (like user) will allow you to pass a value to the Team action in the controller, and should get your display
showing the way you want. 

Mar 29, 2011 at 6:28 PM

hi tomcdona thanks for taking the time to explain this.

all of the pages shown in my sitemap above are actually static pages. will the above still work in that situation?

Mar 31, 2011 at 6:35 PM

I'm not quite sure what you mean by static pages.  Do you mean that you have a View called Team and another View called JohnSmith?

If that's the case, you'll have no problem, as you can direct each controller action to which ever View you wish.

If you have WebForms .aspx files, then I'm not sure, as this is all MVC related.