Kieran Senior
Kieran Senior

Reputation: 18220

Empty URL In SiteMapNode

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?

Upvotes: 4

Views: 4497

Answers (2)

Jacob Rohde
Jacob Rohde

Reputation: 921

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.)

Upvotes: 6

Saar
Saar

Reputation: 8484

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.

Upvotes: -1

Related Questions