C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Menu based on Sitemap


Posted Date: 16 May 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms
Author: KamalMember Level: Gold    
Rating: Points: 50



For creating menu based on sitemap,Firstly create Web.sitemap (Define Sitemap).Web.Sitemap has Title,Url and description attributes.


<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Default.aspx" title="Home" description="Home">
<siteMapNode url="~/contactus.aspx" title="Contact US" description="Contact US"/>
<siteMapNode url="~/aboutus.aspx" title="About Us" description="About Us"/>
<siteMapNode url="~/articles.aspx" title="Articles" description="Articles"/>
</siteMapNode>
</siteMap>


Then,in master page or .aspx drag and drop asp.net control and SiteMapDataSource.And set menu DataSourceID property to SiteMapDataSource.


<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" Font-Names="Verdana"
Font-Size="0.8em" ForeColor="#7C6F57" Orientation="Horizontal" StaticSubMenuIndent="10px"
BackColor="#F7F6F3" DynamicHorizontalOffset="2" StaticDisplayLevels="2"></asp:Menu>



<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />


When you required Horizontal or Vertical menu then just set Orientation property of menu.By default this property set to Vertical.

In code we use DynamicHorizontalOffset property of menu to Gets or sets the number of pixels to shift a dynamic menu horizontally relative to its parent menu item.

In code we use StaticDisplayLevels property of menu to specify the number of menu levels to display in a static menu.




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Get all Session keys
Previous Resource: Update Image to Database using Fileupload
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use