SiteMapPath控件默认情况下是使用根目录下的Web.sitemap作为数据源的,但是这是可以改变的,只要修改一下设置即可。
1、在web.config文件中添加:
代码
<
siteMap
>
< providers >
< add siteMapFile = " ~/App_Data/Job.sitemap " name = " JobXmlSiteMapProvider "
type = " System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a " />
</ providers >
</ siteMap >
< providers >
< add siteMapFile = " ~/App_Data/Job.sitemap " name = " JobXmlSiteMapProvider "
type = " System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a " />
</ providers >
</ siteMap >
2、使用SteMapPath控件,指定SiteMapProvider的值,例如:
<asp:SiteMapPath ID="jobSiteMapPath" runat="server" PathSeparator=" → " SiteMapProvider="JobXmlSiteMapProvider"></asp:SiteMapPath>