.NET
  Home arrow .NET arrow Page 4 - Web Site Navigation Using a SiteMap
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Web Site Navigation Using a SiteMap
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 8
    2006-11-15

    Table of Contents:
  • Web Site Navigation Using a SiteMap
  • Adding a SiteMap to the site
  • Site Navigation with Menu Control
  • Where should we place the menu control?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Web Site Navigation Using a SiteMap - Where should we place the menu control?


    (Page 4 of 4 )

    Since the navigational menu should be available from all pages, the ideal place for the menu control is the Master Page. We need to add a SiteMapDataSource control which runs at the "Server" that extracts site structure related data that feeds a navigational control. We also need to add a navigational control which will look up this data source to navigate through the web pages. We will be adding two controls from the toolbox where they are shown in the next picture.

    You may drag and drop them onto the locations shown on the MasterPage.

    The design view of this page is shown in the next picture.

    The menu control has a large number of properties, both static and dynamic, as well as for interactive display. However its DataSourceID property should match with the SitaMapDataSource's ID Property as shown in the next picture.

    <asp:Menu ID="Menu1" 
    runat="server" 
    DataSourceID="SiteMapDataSource1"  Height="277px" 
    BackColor="#FFFBD6" 
    DynamicHorizontalOffset="2" 
    Font-Names="Verdana" 
    Font-Size="0.4em" 
    ForeColor="#990000" 
    StaticSubMenuIndent="10px">
    <StaticMenuItemStyle HorizontalPadding="5px" 
    VerticalPadding="2px" 
    Font-Size="Small" />
    <DynamicHoverStyle BackColor="#990000" 
    ForeColor="White" />
    <DynamicMenuStyle BackColor="#FFFBD6" />
    <StaticSelectedStyle BackColor="#FFCC66" />
    <DynamicSelectedStyle BackColor="#FFCC66" />
    <DynamicMenuItemStyle Font-Size="Medium" 
    HorizontalPadding="5px" 
    VerticalPadding="2px" />
    <StaticHoverStyle BackColor="#990000" 
    ForeColor="Maroon" Font-Size="Medium" />
    <StaticMenuStyle BackColor="#FFFFC0" BorderColor="#C0C000" />
    </asp:Menu>
     
    <asp:SiteMapDataSource ID="SiteMapDataSource1"  
    runat="server" />

    With this association between the menu control and the SiteMapDataSource, the site navigation can be immediately verified as shown in the following two displays. This picture shows the page Coldfusion.aspx. When you hover over the menu you can see the various pages to which you can navigate using this menu. The placement of the menu control and its look may not be aesthetically pleasing, but the idea is to demonstrate the functionality of navigation.

    You may navigate to another page, such as Ado.aspx, and you will see the following display in your browser.

     

    Summary

    Site navigation is extremly easy to implement using the ASP.NET 2.0 infrastructure consisting of SiteMap, SiteMapDataSource and navigational controls. This can be very useful for those interested in getting an aesthetically pleasing web site up and running in record time. For those of you who used the Site Diagram, the Site Designer and the Navigation Bar controls in Visual InterDev, the functionality provided with in .NET Framework for site navigation should be a Godsend. It must be remembered that site pages not included in the Web.sitemap cannot be reached by the navigation controls unless you take other measures.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · A good navigation system is essential for user satisfaction. Can you always comeback...
       · My problem is explained in the falowing:Compiler Error Message: CS0716: Cannot...
       · I am sorry you have a problem. Could you kindly explain what you are trying to...
     

    .NET ARTICLES

    - Building Applications with Windows Workflow ...
    - Building the Data and Business Layers Using ...
    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek