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

Posted by Hemachandranvperumal under ASP.NET on 11/26/2012 | Points: 10 | Views : 57003 | Status : [Member] | Replies : 3
how to create menu bar?
like
home.about.client.contact.
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..




Responses

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

Up
0
Down

Resolved
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="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" 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>
<siteMapNode resourceKey ="Assignment" roles ="*">
<siteMapNode url="~/Assignment/Assignment1.aspx" resourceKey="Assignment1" roles="*"></siteMapNode>
</siteMapNode>
<siteMapNode resourceKey="Admin" roles="*">
<siteMapNode resourceKey="MasterMainte" roles="*">
<siteMapNode url="~/Admin/MInfo/List.aspx" resourceKey="MInfoMainte" roles="*"></siteMapNode>
</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>
</siteMapNode>
</siteMapNode>
</siteMapNode>
</siteMap>


3.In Web.config file
<system.web>

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


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" />
</asp:Menu>
</asp:Panel>



I think this helps u....


-Somu

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

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

Up
0
Down
Hi..
You can create menu control using user control page..then you can use menu control master page..
For more refer the below inks...
http://www.dotnetcode.in/2011/06/creating-aspnet-menu-control-using-css.html

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

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

Up
0
Down
Steps:
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