日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
ASP.NET2.0數(shù)據(jù)教程:添加站點地圖

管理一個由大量網(wǎng)頁組成的網(wǎng)站的其中一個挑戰(zhàn)是要為訪問者瀏覽網(wǎng)站提供一個捷徑。作為開始,站點的導航結(jié)構(gòu)必須被定義。下一步,這個結(jié)構(gòu)必須轉(zhuǎn)換成適于導航的用戶界面元素,比如菜單或者位置導航。當有新頁面添加到站點和已有的頁面被移除的時候這個過程將要修改和校正。

網(wǎng)站建設哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設計、網(wǎng)站建設、微信開發(fā)、重慶小程序開發(fā)公司、集團企業(yè)網(wǎng)站建設等服務項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了休寧縣免費建站歡迎大家使用!

在asp.net 2.0以前,開發(fā)者需要自己創(chuàng)建站點導航結(jié)構(gòu),維護它并且將它轉(zhuǎn)化為適于導航的用戶界面元素。在asp.net 2.0里,開發(fā)者可以利用非常靈活的且內(nèi)置的站點導航系統(tǒng)。asp.net 2.0站點導航系統(tǒng)允許開發(fā)者定義一個站點地圖并且提供了可以訪問這些信息的API。

默認的asp.net站點地圖提供者期望站點地圖信息存儲在xml格式的文件中。但是,建立在提供者模型上的站點導航系統(tǒng)是可以被擴展的以支持多種方式儲存的站點地圖。Jeff Prosise的文章,The SQL Site Map Provider You’ve Been Waiting For展示了怎樣創(chuàng)建將站點地圖存儲在SQL Server數(shù)據(jù)庫里的提供者;另外一個選擇是基于文件系統(tǒng)的站點地圖提供者。

在這個指南中,我們?nèi)匀皇褂胊sp.NET2.0里默認的站點地圖提供者。要創(chuàng)建站點地圖,在解決方案管理器里右鍵點擊項目名稱,選擇添加新項,然后選擇站點地圖類型。命名為Web.sitemap然后單擊添加按鈕,則是添加站點地圖。

圖9:向你的項目中添加站點地圖

站點地圖文件是一個xml文件。注意:Visual Studio可以為站點地圖結(jié)構(gòu)提供智能感知。站點地圖文件必須含有< siteMap>作為根節(jié)點,它必須至少含有一個< siteMapNode>子節(jié)點。這個< siteMapNode>元素又可以包含任意數(shù)量的< siteMapNode>子元素。

站點地圖模擬了文件系統(tǒng)。為每個文件夾添加一個< siteMapNode>元素,并且為每個aspx頁面添加一個< siteMapNode>子元素,如此:

Web.sitemap:

 
 
 
 
  1. < ?xml version="1.0" encoding="utf-8" ?>  
  2.  < siteMap xmlns="http://schemas.microsoft.com/aspNet/SiteMap-File-1.0" >  
  3.    
  4.    < siteMapNode url="~/Default.aspx" title="Home" description="Home">  
  5.        < siteMapNode title="Basic Reporting" 
  6.          url="~/BasicReporting/Default.aspx" 
  7.          description="Basic Reporting Samples">  
  8.          < siteMapNode url="~/BasicReporting/SimpleDisplay.aspx" 
  9.           title="Simple Display" 
  10.          description="Displays the complete contents  
  11.           of a database table." />  
  12.         < siteMapNode url="~/BasicReporting/DeclarativeParams.aspx" 
  13.           title="Declarative Parameters" 
  14.           description="Displays a subset of the contents  
  15.             of a database table using parameters." />  
  16.         < siteMapNode url="~/BasicReporting/ProgrammaticParams.aspx" 
  17.          title="Setting Parameter Values" 
  18.          description="Shows how to set parameter values  
  19.           programmatically." />  
  20.       < /siteMapNode>  
  21.  
  22.       < siteMapNode title="Filtering Reports" 
  23.        url="~/Filtering/Default.aspx" 
  24.        description="Samples of Reports that Support Filtering">  
  25.         < siteMapNode url="~/Filtering/FilterByDropDownList.aspx" 
  26.           title="Filter by Drop-Down List" 
  27. description="Filter results using a drop-down list." />  
  28.         < siteMapNode url="~/Filtering/MasterDetailsDetails.aspx" 
  29.          title="Master-Details-Details" 
  30.          description="Filter results two levels down." />  
  31.         < siteMapNode url="~/Filtering/DetailsBySelecting.aspx" 
  32.           title="Details of Selected Row" 
  33. description="Show detail results for a selected item in a GridView." />  
  34.       < /siteMapNode>  
  35.  
  36.       < siteMapNode title="Customized Formatting" 
  37.          url="~/CustomFormatting/Default.aspx" 
  38.          description="Samples of Reports Whose Formats are Customized">  
  39.         < siteMapNode url="~/CustomFormatting/CustomColors.aspx" 
  40.          title="Format Colors" 
  41.          description="Format the grid's colors based  
  42.            on the underlying data." />  
  43.         < siteMapNode  
  44.           url="~/CustomFormatting/GridViewTemplateField.aspx" 
  45.           title="Custom Content in a GridView" 
  46.           description="Shows using the TemplateField to  
  47.           customize the contents of a field in a GridView." />  
  48.         < siteMapNode  
  49.           url="~/CustomFormatting/DetailsViewTemplateField.aspx" 
  50.           title="Custom Content in a DetailsView" 
  51.           description="Shows using the TemplateField to customize  
  52.            the contents of a field in a DetailsView." />  
  53.         < siteMapNode url="~/CustomFormatting/FormView.aspx" 
  54.           title="Custom Content in a FormView" 
  55.           description="Illustrates using a FormView for a  
  56.            highly customized view." />  
  57.         < siteMapNode url="~/CustomFormatting/SummaryDataInFooter.aspx" 
  58.           title="Summary Data in Footer" 
  59.           description="Display summary data in the grids footer." />  
  60.       < /siteMapNode>  
  61.  
  62.   < /siteMapNode>  
  63.  
  64. < /siteMap> 

站點地圖定義了這個站點的導航結(jié)構(gòu),它是層次結(jié)構(gòu)的以便描述站點中各種各樣的區(qū)域。在Web.sitemap中的每個< siteMapNode>元素描述了一個站點結(jié)構(gòu)中的一個區(qū)域。

asp.net通過DotNET 框架中的SiteMap類顯示站點地圖的結(jié)構(gòu)。這個類有一個CurrentNode屬性,它返回當前用戶正在訪問的節(jié)點的信息;RootNode屬性返回站點地圖的根節(jié)點信息(在我們的站點地圖中是Home)。CurrentNode呵RootNode屬性都返回SiteMapNode實例,SiteMapNode包含ParentNode,ChildNodes,NextSibling,PreviousSibling等屬性。添加站點地圖后,這些屬性允許站點地圖的層次可以被遍歷。


當前題目:ASP.NET2.0數(shù)據(jù)教程:添加站點地圖
本文URL:http://www.5511xx.com/article/cdochco.html