I have installed the MvcSiteMap provider and have a basic sitemap defined as follows:
<?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="Borrower" controller="Borrower" action="Index">
<mvcSiteMapNode title="Sign Up" controller="Borrower" action="Create"/>
</mvcSiteMapNode>
<mvcSiteMapNode title="Investor" controller="Investor" action="Index">
<mvcSiteMapNode title="Sign Up" controller="Investor" action="Create"/>
</mvcSiteMapNode>
<mvcSiteMapNode title="Dealer" controller="Dealer" action="Index">
<mvcSiteMapNode title="Sign Up" controller="Dealer" action="Create"/>
</mvcSiteMapNode>
</mvcSiteMap>
My HomeController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Veehco.Models;
using Telerik.Web.Mvc;
namespace Veehco.Controllers
{
public class HomeController : Controller
{
VeehcoEntities _db;
public HomeController()
{
_db = new VeehcoEntities();
}
public ActionResult Index()
{
ViewBag.Message = "Welcome to Veehco!";
return View();
}
public ActionResult About()
{
return View();
}
public ActionResult Contact()
{
return View();
}
public ActionResult MenuPartial()
{
return PartialView("~/Shared/MenuPartial");
}
}
public partial class MenuController : Controller
{
[PopulateSiteMap(SiteMapName = "Veehco", ViewDataKey = "Veehco")]
public ActionResult SiteMapBinding()
{
if (!SiteMapManager.SiteMaps.ContainsKey("Veehco"))
{
SiteMapManager.SiteMaps.Register<XmlSiteMap>("Veehco", sitemap => sitemap.LoadFrom("~/Veehco.sitemap"));
}
return View();
}
public ActionResult Orientation(string orientation)
{
ViewData["orientation"] = orientation ?? "Horizontal";
return View();
}
public ActionResult AnimationEffects(string animation, bool? enableOpacityAnimation, int? openDuration, int? closeDuration)
{
ViewData["animation"] = animation ?? "slide";
ViewData["enableOpacityAnimation"] = enableOpacityAnimation ?? true;
ViewData["openDuration"] = openDuration ?? 200; ViewData["closeDuration"] = closeDuration ?? 200;
return View();
}
}
}
When I build and view this site, only the About and Contact links are visible. How do I setup my sitemap and/or HomeController to display the other top level and sub nodes?
Thansk much!!
I believe you only want to have one
mvcSiteMapNodeelement at the root of themvcSiteMap. Try putting Borrower, Investor, and Dealer within your Home element (at the same level as About and Contact).