Below is simple or cheap approach I took when I wanted to do this. Note I only did this at the first level nodes of the site map, but you could easily expand this subsequent levels by sending the node or searching for the node in the tree.
First the ASP.NET code. Note the CheckForSeparator call.
<asp:Menu ID="menuMain" runat="server" Orientation="Horizontal" DataSourceID="KOH_SiteMapDataSource" MaximumDynamicDisplayLevels="0" OnMenuItemDataBound="menuMain_MenuItemDataBound" >
<StaticItemTemplate>
<asp:HyperLink ID="hlMenuLink" runat="server" Text='<%# Eval("Text") %>' NavigateUrl='<%# Eval("NavigateUrl") %>' ToolTip='<%# Eval("ToolTip") %>' CssClass="LabelBold" /><%# CheckForSeparator(((MenuItem)Container.DataItem).Text) %>
</StaticItemTemplate>
</asp:Menu>
Then the code behind.
/// <summary>
/// Used when binding main menu to see if a | separator should be added at the end.
/// </summary>
/// <param name="MenuText"></param>
/// <returns></returns>
protected string CheckForSeparator(string MenuText)
{
if (SiteMap.RootNode.ChildNodes.Count > 0)
{
if (SiteMap.RootNode.ChildNodes[SiteMap.RootNode.ChildNodes.Count - 1].Title.ToLower() != MenuText.ToLower())
{
return " | ";
}
else
{
return "";
}
}
else
{
return "";
}
}