[英]Attribute being appending as query string
I'm trying to have multiple attributesToIgnore
, so I configured it like: 我正在尝试使用多个
attributesToIgnore
,所以我将它配置为:
attributesToIgnore="hideOnStandard, hideFormatting"
and my Mvc.sitemap
: 和我的
Mvc.sitemap
:
<mvcSiteMapNode title="Filters" controller="Parameterized">
<mvcSiteMapNode title="Filters" controller="Parameterized" action="Index"/>
<mvcSiteMapNode title="Output" controller="Parameterized" action="Output" preservedRouteParameters="id" hideOnStandard="true"/>
<mvcSiteMapNode title="Formatting" controller="Parameterized" action="Formatting" preservedRouteParameters="id" hideFormatting="true" />
</mvcSiteMapNode>
However, it appends the hideFormatting="true"
to the query string for the anchor tag, like: 但是,它将
hideFormatting="true"
附加到锚标记的查询字符串,如:
<a href="/Home/Reports/Formatting/29119?hideFormatting=true">Formatting</a>
How can I actually perform what I am trying to do? 我怎样才能真正完成我想要做的事情? I've tried to delimit the
attributesToIgnore
differently, but other than that I'm not quite sure how else to go about it. 我试图以不同的方式划分
attributesToIgnore
ToIgnore,但除此之外,我不太确定如何去做。 I really don't want to use jQuery or something to strip the query string off. 我真的不想使用jQuery或其他东西来删除查询字符串。
How I know what to render : 我怎么知道要呈现什么:
@model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
@using System.Web.Mvc.Html
@using MvcSiteMapProvider.Web.Html.Models
<ul class="navProgress">
@foreach (var node in Model.Nodes)
{
if (!(node.MetaAttributes.Keys.Contains("hideOnStandard") && TempData["IsStandard"] != null && ((bool)TempData["IsStandard"])))
{
if (!(node.MetaAttributes.Keys.Contains("hideFormatting") && TempData["hideFormatting"] != null && ((bool)TempData["hideFormatting"])))
{
<li @(node.IsCurrentNode ? "class=active" : "")>
@Html.DisplayFor(m => node)
@if (node.Children.Any())
{
@Html.DisplayFor(m => node.Children)
}
</li>
}
}
}
</ul>
As per the MvcSiteMapProvider v3 documentation , attributesToIgnore
should be added to the <siteMap>
section of web.config
. 根据MvcSiteMapProvider v3文档 ,应将
attributesToIgnore
添加到web.config
的<siteMap>
部分。
<siteMap>
<providers>
<add name="MvcSiteMapProvider" type="MvcSiteMapProvider.DefaultSiteMapProvider, MvcSiteMapProvider"
siteMapFile="~/Mvc.Sitemap"
securityTrimmingEnabled="true"
cacheDuration="5"
enableLocalization="true"
scanAssembliesForSiteMapNodes="true"
excludeAssembliesForScan=""
includeAssembliesForScan=""
attributesToIgnore="hideOnStandard,hideFormatting"
nodeKeyGenerator="MvcSiteMapProvider.DefaultNodeKeyGenerator, MvcSiteMapProvider"
controllerTypeResolver="MvcSiteMapProvider.DefaultControllerTypeResolver, MvcSiteMapProvider"
actionMethodParameterResolver="MvcSiteMapProvider.DefaultActionMethodParameterResolver, MvcSiteMapProvider"
aclModule="MvcSiteMapProvider.DefaultAclModule, MvcSiteMapProvider"
routeMethod=""
siteMapNodeUrlResolver="MvcSiteMapProvider.DefaultSiteMapNodeUrlResolver, MvcSiteMapProvider"
siteMapNodeVisibilityProvider="MvcSiteMapProvider.DefaultSiteMapNodeVisibilityProvider, MvcSiteMapProvider"
siteMapProviderEventHandler="MvcSiteMapProvider.DefaultSiteMapProviderEventHandler, MvcSiteMapProvider" />
</providers>
</siteMap>
I believe in v3.x, you also had to ensure there is not a space after the comma or it won't match the attribute correctly.
我相信在v3.x中,你还必须确保逗号后面没有空格,否则它将无法正确匹配属性。
Use: 采用:
attributesToIgnore="hideOnStandard,hideFormatting"
Rather than: 而不是:
attributesToIgnore="hideOnStandard, hideFormatting"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.