Tag: mvcsitemap

在mvc5中使用MvcSiteMap创建面包屑

我想在mvc5中使用MvcSiteMap创建面包屑。 我在下面写了代码。 但我希望当我点击第一,第二,……他们的Id传递给View。 但它不起作用。 我做对了吗? //Controller Name=News Home News first //id=1 second //id=2 third // id=3 About [MvcSiteMapNode(Title = “News”, ParentKey = “News”)] public ActionResult News(int id) { ViewBag.id = id; return View(); }

MVC SiteMap从menuhelper隐藏节点,但在sitepathhelper中显示(breadcrumbs)

我正在尝试从我的站点菜单中隐藏节点,但是在我的面包屑中显示它 我在这里按照教程: https : //github.com/maartenba/MvcSiteMapProvider/wiki/Advanced-Node-Visibility 以上似乎不起作用。 它显示在我的网站菜单和面包屑中。

在MvcSiteMapProvider中为具有动态参数的DynamicNode创建子节点

我正在使用MvcSiteMapProvider 2.2.1(http://mvcsitemap.codeplex.com),并且当这些子节点具有动态参数(id)时,在动态节点(使用dynamicNodeProvider)下创建子节点时遇到问题。 我正在丢失以下路线的面包屑: 商店/ 5 /产品/编辑/ 23 url模式的位置是: 存储/ {STOREID} / {控制器} / {行动} / {ID} 当ID被省略时(即“新”动作),它可以正常工作。 但是当指定ID时,它与路径不匹配,并且我的面包屑(使用SiteMapPath帮助程序)是空白的。 我的站点地图:(已删除) 地区注册: public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( “Store_Index”, “Stores”, new { action = “Index”, controller = “Home” }, new string[] { “ControlPanel.Areas.Stores.Controllers” } ); context.MapRoute( “Store_default”, “Stores/{storeID}/{controller}/{action}/{id}”, new { action = “Index”, controller = “Manage”, […]

使用多个MvcSiteMaps

我最近遇到了试图使用MvcSiteMapProvider的路障 。 在我的申请中,我有三个不同的领域:着陆,应用和管理。 我目前已经实现了MvcSiteMapProvider,它的工作效果令人惊讶,但我现在要做的是 – 使用Html MvcSiteMap Helper并根据我所在的区域指定不同的地图提供者。 所以,当我: 在“Admin”区域中 – 我想使用名为“AdminSiteMapProvider”的提供程序。 在“应用程序”区域中 – 我想使用名为“AppSiteMapProvider”的提供程序。 我尝试过以下方法: 共享 – > _AppLayout.cshtml @Html.Partial(“_Menu”) 共享 – > _Menu.cshtml @{ if (HttpContext.Current != null && HttpContext.Current.Handler is System.Web.Mvc.MvcHandler) { var handler = HttpContext.Current.Handler as System.Web.Mvc.MvcHandler; var currentArea = handler.RequestContext.RouteData.Values[“area”] ?? string.Empty; if (!string.IsNullOrEmpty(currentArea.ToString())) { @Html.MvcSiteMap(“AppSiteMapProvider”).Menu() } else if (currentArea.ToString() […]

MvcSiteMap生成菜单而不会弄乱面包屑

我正在配置我的asp.net mvc 5应用程序以使用MvcSiteMap库。 所以,我可以成功配置面包车。 但是,菜单的模板比面包屑更复杂。 我有菜单的胡子版本(我没有显示ul标签): class}}>{{! print class name (active, open, etc) if it exists }} submenu?}}> {{#icon}}{{/icon}} {{#level-1}} {{/level-1}} {{#level-2}}{{! if level-2 and no icon assigned, use this icon}} {{^icon}}{{/icon}} {{/level-2}} {{title}} {{#badge}} tooltip}}>{{{badge}}} {{/badge}} {{#label}} label-title}}>{{{label}}} {{/label}} {{#level-1}} {{/level-1}} {{#submenu?}}{{/submenu?}} {{#submenu?}}{{! if we have submenu items, print them recursively }} {{#submenu}} {{> […]