Binding Label to SiteMap Current Node
I want to do something like this:
<asp:Label ID="titleLabel" runat="server"
**Text='<%# SiteMap.CurrentNode.Title %>'**></asp:Label>
Where can I bind the name of the current page node in the sitemap to the title tag on that page. We do this because, until we get these names, they can change frequently. The above code doesn't work, at least for me; it doesn't display anything.
Any ideas are appreciated.
EDIT: Obviously I could do it in code (for example, in a page load case or something), but I would rather do it in aspx code.
0
a source to share
3 answers
As an alternative to using the label, you can also use the SiteMapPath control and hide the parent nodes:
<asp:SiteMapPath ID="SiteMapPath1" runat="server" ParentLevelsDisplayed="0">
The ParentLevelsDisplayed property allows you to specify how many parent nodes of the current sitemap node you want to display.
+2
a source to share