Google Search

Google
 

Wednesday, May 28, 2008

Menu based on Sitemap

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.

2 comments:

Anonymous said...

With out a doubt, amongst the most appealing traits a man can possess is confidence.


my page Pick Up A Girl (tma-music.com)

Anonymous said...

Hi there, just became alert to your blog through Google, and found that it's truly informative.
I am going to watch out for brussels. I will be grateful if
you continue this in future. Lots of people will be
benefited from your writing. Cheers!

My webpage ... żółć