Culture change breaks Children

Feb 2, 2011 at 6:01 PM

I've got the dynamic node providers fully functional now.  I can browse the entire site properly and moving up and down in the site map works properly.
All children are in the correct location and with the correct resource lookups.

Starting with any culture allows the Site Map to work perfectly within that culture (ie browse to French homepage, entire site map works perfectly) but 
once I move to another culture, all children are reported as the first element every time.

So moving to English, URL would list /en/Equip/Loading/Trackless/456 however the Site map would say I'm on /en/Equip/Loading/Track/1
It's always the first child of each level.  Moving back to the French Culture returns everything to functional.

I read in earlier Discussions there were problems with Culture, but it sounded like those issues were resolved.
Any thoughts? 

Coordinator
Feb 4, 2011 at 10:36 AM

Can you post your sitemap?

Feb 4, 2011 at 1:00 PM

Here's the Sitemap

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-2.0" enableLocalization="true">
    <mvcSiteMapNode title="$Resources:Strings,NavEquipmentLoading" controller="Loading" action="Index">
	<mvcSiteMapNode action="Type" dynamicNodeProvider="nvpMVC.Areas.Equipment.Code.LoadingDynamicNodeProvider, nvpMVC">
		<mvcSiteMapNode action="Details" dynamicNodeProvider="nvpMVC.Areas.Equipment.Code.LoadingDetailsDynamicNodeProvider, nvpMVC" visibility="SiteMapPathHelper,!*"/>
	</mvcSiteMapNode>
    </mvcSiteMapNode>
</mvcSiteMap>

The dynamic providers:
LoadingDynamicNodeProvider:
foreach (var item in load)
{
	DynamicNode node = new DynamicNode("Loading_"+item.path, item.resource);
	node.Key = "Loading_" + item.path;
	node.RouteValues.Add("Type", item.path);
	yield return node;								
}
LoadingDetailsDynamicNodeProvider:
foreach (var item in load)
{
	DynamicNode node = new DynamicNode();				
	node.Title = item.company + " - " + item.Aname;
	node.ParentKey = "Loading_" + ((LoadingType)item.type).ToString();
	node.RouteValues.Add("Type", ((LoadingType)item.type).ToString());
	node.RouteValues.Add("id", item.ID);
	yield return node;
}
I found that in the DetailsProvider I needed to add the two RouteValues or the children wouldn't show up correctly in any situation.
Node Titles are Resource names to handle the different languages.
LoadingType is an enum for translating DB values. 
Feb 8, 2011 at 7:15 PM

I've noticed now that if I disable the visibility filters, the navigation menu displays the sub entries in the correct location and order.

i.e.  
Drilling
Track
1
2
3
Trackless
45
46
47
Hydraulic
Loading

However, when I enable the visibility filter (to remove the numeric entries, and just display them in the breadcrumbs) the breadcrumb values are incorrect.
Is there a significant difference between Models.MenuHelperModel and Models.SiteMapPathHelperModel?

Coordinator
Feb 14, 2011 at 9:16 AM

Menuhelper has more options, but the main code is almost identical.