| Site Navigation |
| |
| SiteMapData Provider |
| |
| The SiteMapDataSource control is a data source to the site map data that is stored by the site map providers that are configured for your site. The SiteMapDataSource enables Web server controls that are not specifically site navigation controls, such as the TreeView, Menu, and DropDownList controls, to bind to hierarchical site map data. You can use these Web server controls to display a site map as a table of contents or to actively navigate a site. |
| |
| The SiteMapDataSource control works with ASP.NET site maps and provides site navigation data. This data includes information about the pages in your Web site, such as the URL, title, description, and location in the navigation hierarchy. Storing your navigation data in one place makes it easier to add and remove items in the navigational menus of your Web site. |
| |
| The SiteMapDataSource is specialized for navigation data and does not support common database operations like sorting, filtering, paging and caching. |
| |
| The SiteMapDataSource control have various properties to change the display of data in any control that binds the data output, such properties are given below: |
| |
| ShowStarting Node: This property decides whether the root node of the .sitemap file is retrieved with retrieved collection of node objects. This property has a Boolean value and is set to true by default. |
| |
<asp:SiteMapDataSource Id=?MySiteMapDataSource? Runat=?server?
ShowStartingNode=?False? />
<asp:Menu ID="MyMenu" runat="server" DataSource=?MySiteMapDataSource? StaticDisplayLevels="3">
</asp:Menu ID> |
| |
| This will remove the root node and menu starts by using the child nodes of the roots node. |
| |
| ShowFromCurrentNode:This property causes the SiteMapDataPrpvider to retrieve only a node collection that starts from the current node of the page being viewed. It also has a Boolean value which is set false by default. |
| |
<asp:SiteMapDataSource Id=?MySiteMapDataSource? Runat=?server?
StartFromCurrentNode=?True? />
<asp:Menu ID="MyMenu" runat="server" DataSource=?MySiteMapDataSource? StaticDisplayLevels="3">
</asp:Menu ID> |
| |
Starting NodeOffset: It takes an integer values that determines the starting point of the hierarchy. The default value is 0, which means that the node collection retrieved by the SiteMapDataSource control starts with the root node.
StartingNodeUrl: By using this property you can specify the web page found in the .sitemap file from which the node collection should start. The default value for this property is empty. |
| |
<asp:SiteMapDataSource Id=?MySiteMapDataSource? Runat=?server?
StartingNodeUrl=?MyPage.aspx? />
<asp:Menu ID="MyMenu" runat="server" DataSource=?MySiteMapDataSource? StaticDisplayLevels="3">
</asp:Menu ID> |
| |
| When the StartingNodeUrl property is faced, the value is compare against the url attributes in the Web.sitemap file. When a match is found, the matched page is the one used as the root node in the node collection retrieved by the SiteMapDataSource control. |
| |
|
| |