Designing Menu using Sitemap and asp menu control

December 6, 2007 at 1:25 pm (.NET, ASP.NET, Web Design)

Menu can also be designed using the sitemap and the asp menu control. For this first the structure of the menu need to be designed first. Then web.sitemap for the menu is designed. web.Sitemap is an XML file that should be stored in the root directory of the website. It contains a root node <siteMapNode>. This node in turn contains multiple sitemap node for each menu item. Sitemap node has the following important attributes title, url and description.

Title : specifies the text need to be displayed on the page.

Url : Specifies the link path.

description : Specifies the tooltip text.

Part of web.sitemap is displayed below:-

<?xml version=”1.0″ encoding=”utf-8″ ?>
<siteMap xmlns=”; >
<siteMapNode url=”” title=”Tour Resources” description=”Tour Resources” >
<siteMapNode url=”” title=”Route Notes &amp; Tour info” description=”Route Notes and Tour info”>
<siteMapNode url =”../et_uk_rns.aspx” title =”Route Notes ET” description =”Route Notes ET”/>
<siteMapNode url =”../gat_rns.aspx” title =”Route Notes GAT” description =”Route Notes GAT”/>
<siteMapNode url =”../tour_summaries.aspx” title =”Tour Summaries” description =”Tour Summaries”/>
<siteMapNode url =”../tour_schedules.aspx” title =”Tour Schedules” description =”Tour Schedules”/>
<siteMapNode url=”../educationlm.aspx” title=”Educational Material” description=”Educational Material”></siteMapNode>
<siteMapNode url=”” title=”Free Time Posters” description=”Free Time Posters”>
<siteMapNode url =”../et_cityins.aspx” title =”Free Time Posters ET” description =”Free Time Posters ET”></siteMapNode>
<siteMapNode url =”../gat_cityins.aspx” title =”Free Time Posters GAT” description =”Free Time Posters GAT”></siteMapNode>
<siteMapNode url =”../cb_cityins.aspx” title =”Free Time Posters CB” description =”Free Time Posters CB”></siteMapNode>
<siteMapNode url=”../extrawts.aspx” title=”Walking Tours” description=”Walking Tours”></siteMapNode>
<siteMapNode url=”” title=”TD Travel” description=”TD Travel”>
<siteMapNode url =”../tdovernight.aspx” title =”TD Overnights” description =”TD Overnights”></siteMapNode>
<siteMapNode url =”../tdflights.aspx” title =”TD Flights” description =”TD Flights”></siteMapNode>

Then in the page where the menu need to be displayed, we need to use asp SiteMapDataSource control. Then we can use asp menu control and point the DatasourceId to the above SiteMapDataSource.

Sample Code:-

<asp:Menu DataSourceID=”SiteMapDataSource1″ ID=”Menu1″ runat=”server” BackColor=”#FFFFFF” BorderColor=”#F57F2C” BorderWidth=”1px” DynamicHorizontalOffset=”2″ StaticSubMenuIndent=”10px” >
<DynamicMenuStyle BackColor=”White” BorderColor=”#F57F2C” BorderWidth=”1px” />
<StaticMenuItemStyle BorderColor=”#F57F2C” BorderWidth=”1px” HorizontalPadding=”5px” VerticalPadding=”2px” />
<DynamicMenuItemStyle BorderColor=”#F57F2C” BorderWidth=”1px” HorizontalPadding=”5px” VerticalPadding=”2px” Font-Bold = “true” Font-Italic = “true” Font-Names = “verdana” Font-Size = “small” />
<%– <StaticSelectedStyle BackColor=”#F57F2C” BorderColor=”#F57F2C” BorderWidth=”1px” ForeColor=”White” />
<DynamicSelectedStyle BackColor=”#F57F2C” BorderColor=”#F57F2C” BorderWidth=”1px” ForeColor=”White”/> –%>
<StaticHoverStyle BackColor=”#F57F2C” BorderColor=”#F57F2C” BorderWidth=”1px” ForeColor=”White” />
<DynamicHoverStyle BackColor=”#F57F2C” ForeColor=”White”/>
<asp:SiteMapDataSource ID=”SiteMapDataSource1″ Runat=”server” ShowStartingNode=”false”/>

ShowStartingNode : It specifies that the sitemapdatasource should not display the root node in the menu.


SiteMapDataSource will get the data from web.sitemap automatically.



  1. vijaybabu said,

    im currently using the same of method of menu with sitemap data source. my problem is,

    if i access 0th item its title is coming correctly like this


    but when i access 1th or >1th item, an error is coming that value is out of range


    when i check the mainmenu.count it is 1. i dont understand how is working.

  2. nirmal kumar said,

    If the count is 1 it means there is only one item in menu which is the 0th item. Hence when you access “mainmenu.items[1].text.tostring();” it will throw an error.

  3. sumit said,

    here u can find many computer problems dude thanks for your support and you can put your problem also link computer problem , blogging tips , computer tips, vidoea, softwares,

  4. Arkell said,

    Grant you just made yourself something to do with it,

  5. Dalip said,

    am new to, will this demo project works if my horizontal menu comes from sql database

  6. Eye coffee said,

    Well i like the way you represented. And i love the chocoo dip cake and bread too. I use to have chocoo cream while i do sex with my GF. Also i had sex with some celebrity like emma watson & paris hilton and both like sex with chocoo andsoft cialis..

  7. frenky said,

  8. ahole ahole said,

    hey unit inch in goats ahole where is the source code and proiject for download u sob

  9. ahole ahole said,


  10. Rqkwogov said,

    This is the job description japanese lesbian young dcdd

  11. Kiuezxuq said,

    I’m happy very good site teen lolita

  12. Nrvxmger said,

    Where did you go to university? glamour models

  13. Wkqkauai said,

    I’d like to transfer some money to this account Preteen Nude Nymphets =O

  14. Oocaefzd said,

    I can’t get a dialling tone Lolitas High Pthc %-P

  15. Iogvzfvj said,

    Your cash is being counted Underage Pussy Pics 1217

  16. Rbgyrrqq said,

    Could you transfer $1000 from my current account to my deposit account? Lolita World :))

  17. Wvvurlvm said,

    I’ll text you later Kid Emo Model

  18. Nsmuxqar said,

    Why did you come to ? top preteens and lolitas hhqg

  19. Mefivoqd said,

    What’s your number? fresh nude little nymphets Arch – I think the levels might have been a bit off, usually it’s not like that. I’m trying to stay natural, and I’m not the biggest dirty talker. Just the occasional sweet nothings.

  20. [RESOLVED]Asp Menu question | ASP Questions & Answers said,

  21. Johne759 said,

    Howdy would you mind sharing which blog platform you’re working ggbfdceekdgd

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: