SiteMapPath 控件使用经验

来源:互联网 发布:中控软件密码 编辑:程序博客网 时间:2024/05/14 05:34

1.web.sitemap文件只有一个,一定要放在根目录下才有效果。

2.要注意路径问题,主目录下的文件夹页面要把文件夹的路径也写进去。例如:<siteMapNode url="~/parttime/P_index.aspx" title ="兼职首页" description="大学糖兼职">

3.属性解析:sitemapnode是导航的根节点,URL为需要显示的页面的文件名,title是显示时的文字,description为描述的内容。

4.使用这个控件简单,主要的原理,现在说一下,就是siteMapNode下一个包着令一个(或多个)这样就形成了,主目录和副目录了,最大的目录是siteMapNode,最小的也是siteMapNode;

例如:

     <siteMapNode url="~/parttime/P_index.aspx" title ="兼职首页" description="">
           <siteMapNode url="~/parttime/P_information.aspx" title="详细信息"  description="详细信息" />
           <siteMapNode url="~/parttime/P_KeyselectResult.aspx" title="搜索结果"  description="搜索结果" />
    </siteMapNode>

这是一种:兼职首页包着下面两个副标,可是也可以如下:

  <siteMapNode url="~/Default.aspx" title="大学糖首页"  description="大学糖首页">

         <siteMapNode url="~/parttime/P_index.aspx" title ="兼职首页" description="">
             <siteMapNode url="~/parttime/P_information.aspx" title="详细信息"  description="详细信息" />
            <siteMapNode url="~/parttime/P_KeyselectResult.aspx" title="搜索结果"  description="搜索结果" />
         </siteMapNode>

  </siteMapNode>

写的时候就是一层包着另一层

4.当位置是在母版页时,只要设置好Web.Config就OK啦,就是不需要在其他引用了;使用的时候,母版页只要拉一个,子页就会自动引用哦,好啦,完毕。