当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > ASP.NET 2.0写无限级下拉菜单

ASP.NET
从ASP.NET的PHP执行速度比较谈起
基于ASP.NET2.0的非HttpModule山寨版MVC框架的实现
ASP.NET 中公有的六种验证控件
无废话C#设计模式之八:Facade
C# 中的 @ 符号的使用及注意事项
保护你的.Net代码:谁动了我的组件?
VS2008与.NET 3.5的JS智能感知和调试
关于 .Net 开发下的分布式缓存设计
在C#3.0中使用扩展方法来扩展接口
C#实现Windows 服务的制作安装和删除
C#3.0中实现隐式类型变量、匿名类型的方法
C#代码与javaScript函数的相互调用
构建 ASP.NET AJAX 开发环境
Windows 窗体的.Net 框架绘图技术
.NET 开发中的一些小技巧集锦
ASP.NET 2.0 创建母版页引来的麻烦
.NET Compact Framework 概述
.NET Compact Framework 2.0 SP1新增功能
专家访谈:从Web 2.0到Web 3.0
.Net里漂浮窗口拖动的实现方法

ASP.NET 2.0写无限级下拉菜单


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-11   浏览: 71 ::
收藏到网摘: n/a

ASP.NET 2.0提供了一个Menu 类,可以方便地创建水平或者垂直方向的下拉菜单,下面就是一个例子:
复制代码 代码如下:

<%@ Page Language="C#" %>
<html>
<!-- ASP.NET 2.0的例子 -->
<head runat="server">
</head>
<body>
<form runat="server">
<h3>下拉菜单的例子</h3>
<!-- Use declarative syntax to create the -->
<!-- menu structure. Submenu items are -->
<!-- created by nesting them in parent menu -->
<!-- items. -->
<asp:menu id="NavigationMenu"
disappearafter="2000"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Horizontal"
font-names="Arial"
target="_blank"
runat="server">
<staticmenuitemstyle backcolor="#DDDDDD"
forecolor="red"/>
<statichoverstyle backcolor="#DDDDDD"/>
<dynamicmenuitemstyle backcolor="#EEEEEE"
forecolor="red"/>
<dynamichoverstyle backcolor="#DDDDDD"
forecolor="Black"/>
<items>
<asp:menuitem navigateurl="http://dotnet.aspx.cc/"
text="首页"
tooltip="首页">
<asp:menuitem navigateurl="http://dotnet.aspx.cc/ShowList.aspx?id=1"
text="ASP.NET 栏目"
tooltip="ASP.NET 栏目">
<asp:menuitem navigateurl="Classical.aspx"
text="ASP.NET 最新文章"
tooltip="ASP.NET 最新文章"/>
<asp:menuitem navigateurl="Rock.aspx"
text="ASP.NET 问与答"
tooltip="ASP.NET 问与答">
<asp:menuitem navigateurl="Classical.aspx"
text="ASP.NET 最新文章"
tooltip="ASP.NET 最新文章"/>
<asp:menuitem navigateurl="Classical.aspx"
text="ASP.NET 最新文章"
tooltip="ASP.NET 最新文章"/>
</asp:menuitem>
<asp:menuitem navigateurl="Jazz.aspx"
text="Jazz"
tooltip="Jazz"/>
</asp:menuitem>
<asp:menuitem navigateurl="Movies.aspx"
text="Movies"
tooltip="Movies">
<asp:menuitem navigateurl="Action.aspx"
text="Action"
tooltip="Action">
<asp:menuitem navigateurl="Drama.aspx"
text="Drama"
tooltip="Drama"/>
</asp:menuitem>
<asp:menuitem navigateurl="Drama.aspx"
text="Drama"
tooltip="Drama"/>
<asp:menuitem navigateurl="Musical.aspx"
text="Musical"
tooltip="Musical"/>
</asp:menuitem>
</asp:menuitem>
</items>
</asp:menu>
</form>
</body>
</html>