-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: Swapnil_B1
Message 1 in Discussion

  
Site Map Providers 
Site map providers provide the interface between ASP.NET's data-driven 
site-navigation features and site map data sources. The two most common reasons 
for writing a custom site map provider are: 
• You wish to store site maps in a data source that is not supported by the 
site map providers included with the .NET Framework, such as a Microsoft SQL 
Server database. 
• You wish to store site map data in an XML file whose schema differs from that 
of the one used by System.Web.XmlSiteMapProvider. 
The fundamental job of a site map provider is to read site map data from a data 
source and build an upside-down tree of SiteMapNode objects (Figure 10), and to 
provide methods for retrieving nodes from the site map. Each SiteMapNode in the 
tree represents one node in the site map. SiteMapNode properties such as Title, 
Url, ParentNode, and ChildNodes define the characteristics of each node and 
allow the tree to be navigated up, down, and sideways. A single site map can be 
managed by one or several providers. Site map providers can form a tree of 
their own, linked together by their ParentProvider properties, with each 
provider in the tree claiming responsibility for a subset of the site map. A 
SiteMapNode's Provider property identifies the provider that "owns" that node. 
Site Navigation in ASP.NET 1.x
ASP.Net Version 1.x did not provide any built-in site navigation support; 
therefore, most developers implemented their own site navigation functionality. 
In creating their own site navigation functionality, developers were faced with 
two challenges: 
1.      Decide how to serialize the site's structure information into a site 
map, and 
2.      Implement the navigation user interface elements. 
Site Navigation in ASP.NET 2.0
Implementing site navigation in ASP.NET 2.0 is a breeze, thanks to the building 
site navigation features. Internally, ASP.NET offers a programmatic API that 
enables the site map to be queried. ASP.NET does not require a particular 
format for specifying the site map, although it does provide a default choice 
that uses an XML-formatted file. The details on how the site map is seralized 
can be customized because the site navigation feature of ASP.NET 2.0 uses the 
provider model. 
 
Site Map Controls 
In addition to providing a customizable means to specify site structure, 
ASP.NET 2.0 ships with a number of navigation Web controls that make displaying 
the site map as easy as dragging and dropping a control onto your ASP.NET page: 
       SiteMapPath - displays a breadcrumb, showing the end user where he is 
relative to the site's structure. For example, when visiting the Novels section 
on Amazon.com, a breadcrumb would display something like: Home > Books > 
Novels.  TreeView - displays the site's structure in a collapsible tree.        
 Menu - displays the site's structure using a menu.
When displaying site navigation, both the TreeView and Menu controls use the 
SiteMapDataSource control to read the contents of the site map. 
Since the site navigation piece is implemented using the provider model, the 
controls are oblivious to the inner details on how the site map is serialized. 
That is, regardless of whether you use the default site map or roll your own 
custom site map logic, the navigation controls can be used to work against your 
site map of choice. 
Defining the Site Map 
The hierarchy of SiteMapNodes objects is how the site map is represented in 
memory when its examined through ASP.NET 2.0's site navigation API. This site 
map, however, must be physically serialized in some manner, such as an XML file 
or in a database table. By default, ASP.NET 2.0 provides a default 
implementation of serializing the site map using an XML formatted file. To use 
this technique, you'll need to create an XML file in your web application's 
root directory named Web.Sitemap that has the following structure:<?xml 
version="1.0" encoding="utf-8" ?><siteMap 
xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0";>  <siteMapNode 
attributes>    <siteMapNode attributes>      <siteMapNode attributes>      ...  
  </siteMapNode>    <siteMapNode attributes />    ..    <siteMapNode attributes 
/>  </siteMapNode></siteMap> 
Displaying the Site Map Using the Navigation Web Controls
Now that we have a site map defined, we're ready to display the site map's data 
through an ASP.NET page. As aforementioned, there are three built-in navigation 
Web controls: the SiteMapPath, the TreeView, and the Menu. Using these controls 
is simple - just drag them onto the ASP.NET page and configure the properties 
to adjust the control's appearance to fit your site's look and feel.  To add 
the SiteMapPath to the main pane, I simply dragged and dropped the SiteMapPath 
control from the Toolbox onto the master page. When adding a TreeView control 
(or Menu) you need to first add a SiteMapDataSource control to the page; next, 
add the TreeView (or Menu) and set its DataSourceId property to the ID of the 
SiteMapDataSource control (this can be done through the TreeView's smart tag). 
The SiteMapDataSource control queries the site map through the site navigation 
API and provides the complete site map structure to the TreeView (or Menu) 
controls. 
While we've covered the basics of the site map, we've still yet to explore more 
advanced functionality. For example, using ASP.NET 2.0's roles feature, you can 
limit the site's sections so that the sections displayed in the navigation 
controls are dependent upon the visiting user's role and the roles defined for 
the section in the site map file. Additionally, the site map includes 
properties to support localization, making it easy to have section titles and 
descriptions unique for each language supported by your site. 
Swapnil (Swaps) 
http://swapsnet.spaces.live.com/

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to