当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 动态下拉菜单的简单实现

ASP.NET
ASP.NET 打造互联网未来空间站(3)
ASP.NET 打造互联网未来空间站(4)
Asp.net+Xml开发网络硬盘
ASP.NET中树形图的实现
ASP.NET中Cookie编程的基础知识(1)
ASP.NET中Cookie编程的基础知识(2)
ASP.NET中Cookie编程的基础知识(3)
ASP.NET中Cookie编程的基础知识(4)
ASP.NET中Cookie编程的基础知识(5)
ASP.NET中Cookie编程的基础知识(6)
ASP.NET中Cookie编程简明参考
ASP.NET中数据库的操作初步(1)
ASP.NET中数据库的操作初步(2)
ASP.NET中数据库的操作初步(3)
最佳ASP.NET编程习惯
Microsoft .NET 框架常见问题(一)
Microsoft .NET 框架常见问题(二)
用Visual C#打造个性化的IE浏览器
.NET Compact Framework的强大二维图形引擎
VB.NET如何在没有.NET框架的机器上运行

ASP.NET 中的 动态下拉菜单的简单实现


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

最近想要在C#下做一个下拉菜单,找了好久也没有找到一个简单的实现方法,自己想了一个;介绍一下:首先在aspx文件中加入如下代码:





//加入链接列

//显示数据库中的Name字段
DataTextField="Name">













以上是aspx文件中要添加的代码
然后在aspx.cs文件中将数据读出邦定到datagrid1上即可用数据库中的Name字段来形成下菜单
如:
protected System.Web.UI.WebControls.DataGrid DataGrid1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
DataView UserProductDataView=new DataView();
//获得数据库视图
UserProductDataView=(new UserProductBF()).GetUserProductType();
DataGrid1.DataSource=UserProductDataView; DataGrid1.DataBind();}运行即可,哈哈,比较简单,我目前是这样做的,不知道这样生成菜单好不好,其出来供大家参考,还望大家不要见笑才好。
Visual Studio 2005 Express Beta Products所有的完整安装包。 如何调用他人提供的Web Service

评论 (0) All

登陆 还没注册?