HOW TO CREATE MENU BAR in ASP.NET.........???? [Resolved]

Posted by Hemachandranvperumal under ASP.NET on 11/26/2012 | Points: 10 | Views : 55730 | Status : [Member] | Replies : 3
how to create menu bar?
if am i click about menu goto about page.
all menu in master page.
i was create the menu but i got many error.i cannot do it.
any one help me pls.
i need step by step.

how to configure in config.file. AND how to create multiple menu ??
pls reply this form..


Posted by: Somu475 on: 11/26/2012 [Member] Starter | Points: 50


Hi Hemachandranvperumal,

There many methods to create Menu, One of the method I prefer is as follows.

1.Add a siteMap file to the project.

2.Inside that mention siteMapNodes for how many menu items u need.

<?xml version="1.0" encoding="utf-8" ?>

<siteMap xmlns="" enableLocalization="true">

<siteMapNode roles="*">
<!-- Sample No Role -->
<siteMapNode url="~/Login.aspx" resourceKey="Logout" roles="*"></siteMapNode>
<siteMapNode url="~/Menu.aspx" resourceKey="Menu" roles="*"></siteMapNode>
<siteMapNode resourceKey="Sample" roles="*">
<siteMapNode url="~/Sample/MasterPageSample.aspx" resourceKey="MasterPageSample" roles="*"></siteMapNode>
<siteMapNode url="~/Sample/InputSample.aspx" resourceKey="InputSample" roles="*"></siteMapNode>
<siteMapNode resourceKey ="Assignment" roles ="*">
<siteMapNode url="~/Assignment/Assignment1.aspx" resourceKey="Assignment1" roles="*"></siteMapNode>
<siteMapNode resourceKey="Admin" roles="*">
<siteMapNode resourceKey="MasterMainte" roles="*">
<siteMapNode url="~/Admin/MInfo/List.aspx" resourceKey="MInfoMainte" roles="*"></siteMapNode>
<siteMapNode resourceKey="SqlLog" roles="*">
<siteMapNode url="~/Admin/SqlLog/List.aspx" resourceKey="SqlLogList" roles="*"></siteMapNode>
<siteMapNode url="~/Admin/SqlLog/Load.aspx" resourceKey="SqlLogLoad" roles="*"></siteMapNode>

3.In Web.config file

<siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
<add name="XmlSiteMapProvider" description="Default SiteMap provider." type="System.Web.XmlSiteMapProvider"
siteMapFile="~/EMS/Web.sitemap" securityTrimmingEnabled="true"/>

4.Then in Master page add a panel and inside panel add menu.
<asp:Panel ID="PnlMenu" runat="server">

<asp:SiteMapDataSource ID="SdsMenu" runat="server" ShowStartingNode="false"/>
<asp:Menu ID="Menubar" runat="server" DataSourceID="SdsMenu" Orientation="Horizontal" >
<StaticMenuStyle CssClass="staticMenu" />
<StaticMenuItemStyle CssClass="staticMenuItem" />
<StaticHoverStyle CssClass="staticHover" />
<StaticSelectedStyle CssClass="menuSelected" />
<DynamicMenuItemStyle CssClass="dynamicMenuItem" />
<DynamicHoverStyle CssClass="dynamicMenuHover" />
<DynamicSelectedStyle CssClass="menuSelected" />

I think this helps u....


Hemachandranvperumal, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 11/26/2012 [Member] Starter | Points: 25

You can create menu control using user control page..then you can use menu control master page..
For more refer the below inks...

Hemachandranvperumal, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandhyab on: 11/27/2012 [Member] Starter | Points: 25

1. Add MasterPage To your Appliaction.
2.Add ContentPages by inheriting those to master Pages
3.Add sitemap to ur application

I have attached Source code olease Go through that. ANd check the output. I hope this will help you.

Thanks & Regards

 Download source file

Hemachandranvperumal, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response