2017-09-18 5 views
0

Ich versuche Breadcrumb-Navigation für meine Anwendung bereitzustellen. Ich habe 3 Controller - Projekt, Aufgabe & TaskDetail.Breadcrumbs mit asp.net mvc 5

Ich brauche die Brotkrümel so etwas wie

Projekte> Projektdetails> Aufgaben> Aufgabendetails

Im Folgenden meine Mvc.sitemap Datei ist zu zeigen,

<?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="Projects" controller="Project" action="ProjectList"> 
    <mvcSiteMapNode title="Project Details" controller="Project" action="Details"/> 
    </mvcSiteMapNode> 
</mvcSiteMap> 

mein Projekt-Controller

public ActionResult ProjectList() 
{ 
///logic to show all projects list 
} 

public ActionResult Details(int id) 
{ 
///logic to show details of a project 
} 

Dies ist mein Task Controller

public ActionResult TaskList(int projectId) 
{ 
///logic to show all tasks of the selected project 
} 

public ActionResult TaskDetails(int id) 
{ 
///logic to show details of a task 
} 

Als ich nach Projektüberaktionsmethode navigieren, erhalte ich die Brotkrümel als

Projects 

aber wenn ich auf Einzelheiten (in Projektsteuerer) Ebene sehe ich nicht einmal die Brotkrumen-

Bitte hilf mir, was ich hier falsch mache.

Dank Tarak

Antwort

0

Sieht aus wie Sie das "Projektdetails" mvcSiteMapNode innerhalb Ihrer "Projekte" mvcSiteMapNode haben.

Ändern Sie Ihren MVC.sitemap Code zu diesem.

<?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="Projects" controller="Project" action="ProjectList"/> 
 
    <mvcSiteMapNode title="Project Details" controller="Project" action="Details"/> 
 
</mvcSiteMap>

+0

Hey @Tommy es funktionierte. Danke für Ihre Hilfe. – Tarak