2013-09-30 3 views
0

이 설정을 고려 선택하지 :.특성을 기반으로 사이트 맵 노드는

public class SampleController : BaseController 
{ 
    [MvcSiteMapNode(Title = "Super Title", Key = "Super", ParentKey = "topNav")] 
    public ActionResult Index() 
    { 
     return View(); 
    } 

    [MvcSiteMapNode(Title = "Sub Title", ParentKey = "Super")] 
    public ActionResult SubAction(Guid id) 
    { 
     return View(); 
    } 
} 

서브 액션을 탐색하여 Html.MvcSiteMap() SiteMap.CurrentNode는 항상 null입니다. 제외 때때로 그것은 단지 하나의 GUID 작동

왜 (I 요청 된 첫 번째를 가정)?

이 인스턴스 외에도 내 프로젝트의 다른 모든 작업에 사용할 수 있습니다.

답변

0

난 그냥

[MvcSiteMapNode(Title = "Sub Title", ParentKey = "Super", PreservedRouteParameters = "id")] 
public ActionResult SubAction(Guid id) 
{ 
    return View(); 
} 
+1

이 커버 = "true"로 PreservedRouteParameters을 추가했다 "어떻게"의 "왜"이 게시물을 참조하십시오 : http://www.shiningtreasures.com/post/2013/ 09/02/how-to-make-mvcsitemapprovider-remember-a-user-position – NightOwl888

+0

고마워요. 매우 도움이된다! – Sam7