selvi subramanian

selvi subramanian

  • NA
  • 799
  • 558.7k

how to use menu tool in asp.net using c#

Apr 6 2014 4:31 AM
how to use menu tool in asp.net using c#. ( i need to use menu in all page without using masterpage . my code is
form design
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MenuControl.aspx.cs" Inherits="MenuControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
.main_menu
{
width: 100px;
background-color: #8AE0F2;
color: #000;
text-align: center;
height: 30px;
line-height: 30px;
margin-right: 5px;
}
.level_menu
{
width: 110px;
background-color: #000;
color: #fff;
text-align: center;
height: 30px;
line-height: 30px;
margin-top: 5px;
}
.selected
{
background-color: #852B91;
color: #fff;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
<asp:Menu ID="Menu" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
OnMenuItemDataBound="OnMenuItemDataBound">
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass="main_menu" />
<asp:MenuItemStyle CssClass="level_menu" />
</LevelMenuItemStyles>
</asp:Menu>
</div>
</form>
</body>
</html>
web.sitemap 
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="Home" description="">
<siteMapNode url="Home.aspx" title="Home" description="Home Page" />
<siteMapNode url="javascript:;" title="REport" description="REport">
<siteMapNode url ="DayBook.aspx" title="DAyBook" description="DayBook"></siteMapNode>
<siteMapNode url ="Purchase.aspx" title="Purchase" description="Purchase"></siteMapNode>
<siteMapNode url ="SalesReport.aspx" title="sales" description="Sales"></siteMapNode>
</siteMapNode>
<siteMapNode url="Help.aspx" title="Help" description="Help" />
<siteMapNode url="About.aspx" title="About" description="About Us Page" />
</siteMapNode>
</siteMap>
 
 
( i need to do the menu in all the page as same without using masterpage in asp.net using c#)
 
 

Answers (2)