我已经安装了 MvcSiteMap 提供程序,并定义了一个基本站点地图,如下所示:
<?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>
我的 HomeController:使用系统;使用 System.Collections.Generic;使用 System.Linq;
使用 System.Web;使用 System.Web.Mvc;使用 Veehco.Models;使用 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();
}
}
}
当我建立和查看这个站点时,只有 About 和 Contact 链接是可见的。如何设置我的站点地图和/或 HomeController 以显示其他顶级和子节点?
非常感谢!!