0

I want show only my parent nodes in my View. This is my sitemap:

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0"           enableLocalization="true">

  <mvcSiteMapNode title="Home" controller="Home" action="Index">
    <mvcSiteMapNode title="About" controller="Home" action="About"/>
    <mvcSiteMapNode title="Contact" controller="Home" action="Contact"/>
  </mvcSiteMapNode>
  <mvcSiteMapNode title="Test" controller="Test" action="Index">
    <mvcSiteMapNode title="Teste2" controller="Test" action="Index"/>
    <mvcSiteMapNode title="Teste3" controller="Test" action="Index"/>
  </mvcSiteMapNode>  
</mvcSiteMap>

How can I use the html helper @Html.MvcSiteMap().Menu() to show only the parent nodes, and only the child nodes? Like this: Parents:

  • Home
  • Test

Childs

  • About
  • Contacts
  • Teste2
  • Teste3

Thanks.

oteal
  • 614
  • 2
  • 13
  • 25

1 Answers1

0

Try for top level

@Html.MvcSiteMap().Menu(0, true, false, 1)

Second level

@Html.MvcSiteMap().Menu(2, 1, true)

This tutorial may help

GraemeMiller
  • 11,973
  • 8
  • 57
  • 111
  • If I try that, I got this exception: NullPointerException... Object reference not set to an instance of an object. – oteal Sep 20 '13 at 08:22