Empty URL In SiteMapNode

让人想犯罪 __ 提交于 2019-12-23 12:18:53

问题


I've got a SiteMap with blank URL attributes in each siteMapNode. Anyone know how to render them if the URL is blank? I'm doing a foreach against the SiteMap.CurrentNode and it doesn't retrieve siteMapNode elements that have empty URL attributes, but I do need to render them (just without a URL).

Any ideas?


回答1:


I do not know it's good or bad practice. But generally for such requirement I do use string "#" as empty url. It serves empty url purpose.




回答2:


To render a site map node with a blank URL, simply remove the URL attribute altogether from the node. It will then render, but not be clickable (if you are using security trimming, include the roles attribute, e.g. roles="*" or e.g. roles="Admin" since there is no URL to authorize against.)



来源:https://stackoverflow.com/questions/1941269/empty-url-in-sitemapnode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!