I need to hide current node in custom bread crumb on master page. I'm using SiteMapPath control which is already customized. I'm taking custom sitemap from web.sitemap file and all is configured in web.config properly.
How to do it?
Thanks for your self-answer, it helped me get started and then I tweaked it and think this code is a little cleaner. Though I didn't analyze it deeply, I think it will run faster since it will only run once when the final node (SiteMapNodeItemType.Current) is bound whereas your code is iterating through that loop each time the event is fired.
protected void Breadcrumb_ItemDataBound(object sender, SiteMapNodeItemEventArgs e)
{
// If this is the current node, hide it along with its
// separator (both have same ItemIndex)
if (e.Item.ItemType == SiteMapNodeItemType.Current)
{
foreach (SiteMapNodeItem node in (from SiteMapNodeItem x in ((SiteMapPath)sender).Controls
where x.ItemIndex == e.Item.ItemIndex
select x).ToList())
node.Visible = false;
}
}