我在带有以下架构的asp mvc中使用内置的asp站点地图
I am using built in asp sitemap in asp mvc with the following schema
schemas.microsoft/AspNet/SiteMap-File-1.0
我具有以下属性,即资源键,标题&描述.我想向sitemapNode添加更多属性,请让我知道是否可以在sitemap文件中添加新属性,然后通过sitemap类进行读取.
I have the following attributes, resourcekey, title & description. I would like to add few more attributes to the sitemapNode, kindly let me know if it is possible to add new attribute in sitemap file and then read it via the sitemap class.
推荐答案SiteMap模式支持自定义属性,可以通过SiteMapNode类的indexer属性对其进行访问.
The SiteMap schema supports custom attributes and they can be accessed via the indexer property of the SiteMapNode class.
例如,如果以下节点是使用自定义工具提示属性在Web.sitemap文件中定义的:
For example if the following node was defined in the Web.sitemap file with custom tooltip attribute:
<siteMapNode url="~/Default.aspx" title="Home" tooltip="My Home Page" />然后可以通过SiteMapNode索引器访问它,例如
It can then be accessed via the SiteMapNode indexer e.g.
string tooltip = siteMapNodeInstance["tooltip"];有关自定义SiteMap的更多信息,请参见此处
More information on customising SiteMaps is available here
更多推荐
将自定义属性添加到ASP.NET MVC的SiteMap中
发布评论