Modifying the PathSeperator

May 26, 2011 at 2:04 PM

I need a way to modify the PathSeperator off of the RootNode. I have a requirement where the root has a blank Title and then the rest of the childnodes appear like ("">Home>SiteMap etc..). So my rootnode has a > with nothing in front of it. I was able to use the ItemCreated event (see below) on the asp:SiteMapPath control to where I can get in and remove the seperator but I haven't been able to find a way to do this on the MVCSiteMap provider. Any assistance is greatly appreciated.



        protected void SiteMapPath1_ItemCreated(object sender, SiteMapNodeItemEventArgs e)
        {            
            if (e.Item.ItemType == SiteMapNodeItemType.Root)
                this.SiteMapPath1.PathSeparator = string.Empty;
            else
                this.SiteMapPath1.PathSeparator = " > ";
        }

Thanks

Mike

Coordinator
May 26, 2011 at 5:28 PM

Feel free to edit the template under Views/Shared/DisplayTemplates :-)

May 26, 2011 at 6:00 PM

Was already modifying the SiteMapNodeModel.ascx didn't event think to look at the other templates. Found the one I needed to accomplish what I need within the SiteMapPathHelperModel.ascx. You're the man!!