Introduction:
To maintain the menu in large site is always a bit difficult and time consuming.
The best way is to create an xml file to store menu in asp.net.
This file is called as web.sitemap,which is stored in the root directory of the web.
It contains the information about the hierarchy of the pages.
In asp.net default site-map provider is automatically picked to show the hierarchy of the pages.
The control automatically connects to the default sitemap file(web.sitemap)
Asp.net contains three navigation control to shows hierarchy of the pages,they are:
1)Dynamic menus
2)TreeViews
3)Site Map Path
For creating a sitemap file there are some rules defined::
The XML file must contain a open and closing tag.
The tag contain only one as a child node
Each can contain one or more child nodes within its open and closing tag.
Each has attributes page title, URL and description.
Examples:
Dynamic Menu
The control displays a standard site navigation menu.
This control act as a placeholder for a server created navigation menu.
Its data source is defined using attribute DataSourceId.
Example:
TreeView
To display multilevel navigation menu this control is used.
This look like a tree with branches that open and closed using + or - symbol.
The data source of the control has DataSourceId attribute.
Example:
SiteMapPath
The SiteMapPath control displays the trail (navigation path) to the current page. The path acts as clickable links to previous pages.
Unlike the TreeView and Menu control the SiteMapPath control does NOT use a SiteMapDataSource. The SiteMapPath control uses the web.sitemap file by default.
Example:
Example of Web.Sitemap ::
Web.SiteMap file:
SiteMapDataSource.aspx
0 Comment(s)