내가 내 프로젝트에 사이트 맵을 추가 할하지만 여전히 오류를 여기Asp.Net MVC 4 사이트 맵
Not all configured nodes could be paired with a parent node. Check your parent keys to ensure that a node with a corresponding key exists in the SiteMap. Note that the match is case sensitive.
을 얻었다는
<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0"
xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0 MvcSiteMapSchema.xsd">
<mvcSiteMapNode title="Home" controller="Home" action="Index" key="Home">
<mvcSiteMapNode title="Quiz" controller="Quiz" action="Index" key="Quiz" dynamicNodeProvider="SiteMapExample.Models.DynamicNodeCategory,SiteMapExample" >
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMap>
지도
내 사이트이며, 여기에 동적 생성 내 모델입니다 사이트 맵 노드public class DynamicNodeCategory : DynamicNodeProviderBase
{
public override IEnumerable<DynamicNode> GetDynamicNodeCollection(ISiteMapNode node)
{
string[]category={".Net","Java","C"};
for (int i = 0; i < 3; i++)
{
DynamicNode dNode = new DynamicNode();
dNode.ParentKey = "Quiz";
dNode.Title = category[i];
dNode.Action = "Test";
dNode.Controller = "Quiz";
dNode.Key = dNode.Title;
dNode.RouteValues.Add("category", dNode.Title);
yield return dNode;
}
}
}
그리고 난 여기 사이트 맵
을 사용하고 있습니다@Html.MvcSiteMap().SiteMapPath()
대답은 snx이지만 동적 노드 공급자에 대해이 속성을 사용하고 있습니다. [MvcSiteMapNodeAttribute (DynamicNodeProvider = "SiteMapExample.Models.DynamicNodeCategory, SiteMapExample")] ' –
@AbhishekSingh - 답변을 업데이트했습니다. – NightOwl888