Navigation menu question

Jul 15, 2010 at 10:40 AM
Edited Jul 15, 2010 at 10:44 AM

Hi,

I want to establish website with a navigation area in the site.master page and a specific content page.
The navigation area should look like:

Navigation Level 1 [MyHome] Samples
Navigation Level 2 [Index] HomePage2
View /Home/Index

Navigation Level 1 [MyHome] Samples
Navigation Level 2 Index [HomePage2]
View /Home/Page2

Navigation Level 1 MyHome [Samples]
Navigation Level 2 [Index] SamplePage2
View /Samples/Index

Navigation Level 1 MyHome [Samples]
Navigation Level 2 Index [SamplePage2]
View /Samples/Samplepage2

Remarks: [XXX] This item should be highlighted, as it is selected

My question:
How would the web.sitemap have to look like ?
How to render the Navigation levels (I'm not interessed in the style, more what function to call with what parameters) ?

The question isn't as trivial as it looks like as in both navigations levels the same controller and Action is used:
Navigation Level 1 [MyHome] Samples -> MyHome-URL: /Home/Index
Navigation Level 2 [Index] HomePage2 -> Index-URL: also /Home/Index

A sample (code snippet) how to archieve this would be perfect!

Thanks, in advance

Coordinator
Jul 20, 2010 at 6:37 AM

The sitemap file can be created using area="" attributes on the nodes rendered.

Jul 20, 2010 at 7:03 AM

Thanks for the answer.

But what does the area attribute help me here ?

Currently I would think of my sitemap-file looks something like

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

      <mvcSiteMapNode         title="My Home"                 controller="Home"       action="Index"              area="" >
     
          <mvcSiteMapNode     title="Index"                   controller="Home"       action="Index"           area=""/>
          <mvcSiteMapNode     title="Homepage2                controller="Home"       action="Homepage2"        area=""/>
         
      </mvcSiteMapNode>

      <mvcSiteMapNode         title="Samples"                 controller="Samples"       action="Index"               area="" >

          <mvcSiteMapNode title="Samples"                     controller="Samples"      action="Index"            area=""  />
          <mvcSiteMapNode title="Page2"                      controller="Samples"      action="SamplePage2"             area=""  />

      </mvcSiteMapNode>

</mvcSiteMap>

The problem there is that more nodes have the same Controller/Action (Home/Index).