Sid*_*idC 3 asp.net-mvc-3 mvcsitemapprovider
我已经安装了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>
Run Code Online (Sandbox Code Playgroud)
我的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();
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我构建和查看此站点时,只有"关于"和"联系"链接可见.如何设置我的站点地图和/或HomeController以显示其他顶级和子节点?
Thansk多!!
| 归档时间: |
|
| 查看次数: |
1350 次 |
| 最近记录: |