C#(ASP.NET)——Menu控制項實現導覽列

來源:互聯網
上載者:User

標籤:

一、開啟aspx檔案,從左邊控制項頁面拖一個Menu控制項和一個SiteMapDataSource控制項。

 設定Menu屬性DataSourceID="SiteMapDataSource1"

 設定SiteMapPath控制項的User的SiteMapProvider為User。
 

二、建立在/User檔案夾下建立User.sitemap網站地圖檔

<?xml version="1.0" encoding="utf-8" ?><siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >  <siteMapNode url="" title="返回首頁"  description="">    <siteMapNode url="~/User/UserDefault.aspx" title="首頁"  description="" />    <siteMapNode url="" title="a"  description="">      <siteMapNode url="~/a/a1.aspx" title="a1"  description="" />      <siteMapNode url="~/a/a2.aspx" title="a2"  description="" />    </siteMapNode>    <siteMapNode url="" title="b"  description="">      <siteMapNode url="~/b/b1.aspx" title="b1"  description="" />      <siteMapNode url="~/b/b2.aspx" title="b2"  description="" />    </siteMapNode>  </siteMapNode></siteMap>

 

三、在Web.config檔案<system.web>下配置

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


 

C#(ASP.NET)——Menu控制項實現導覽列

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.