Search content within the blog

Tuesday, November 18, 2008

Adding sitemap provider details in web.config file

Web.config contents

Put this part of code under <system.web> section

<siteMap>
<providers>
<add name="Web1" type="System.Web.XmlSiteMapProvider" siteMapFile="~/SitemapFiles/Custom.sitemap"/>

</providers>

</siteMap>

Here the name can be any custom name and the siteMapFile"~/SitemapFiles/Custom.sitemap"
is the path of the sitemap file from the root.

type="System.Web.XmlSiteMapProvider" if it is XmlSiteMapProvider(change according to ur need)


ASPX Page OR Master Page
<asp:SiteMapPath ID="SiteMapPath1" runat="server" PathSeparator=">" PathDirection="RootToCurrent" CurrentNodeStyle-BackColor="AliceBlue" NodeStyle-BackColor="Beige" RootNodeStyle-BackColor="ActiveCaption" RenderCurrentNodeAsLink="false" ToolTip="Press on the link to go to the section" >
</asp:SiteMapPath>

Code-Behind
SiteMapPath1.Provider = SiteMap.Providers["Web1"];

No comments:

Post a Comment