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

ASP.NET
ASP.NET错误处理:Runtime Error
如何使用ADO.NET Entity Framework从数据库中获取图片
ASP.NET教程:WaitHandle类
ASP.Net中Ado.Net Entity Framework实际项目应用释疑
ASP.NET页面中控制部分元素隐现的方法
asp.net网站开发中使用Sqlite嵌入式数据库
ASP.NET教程:调用WebService的源码
.NET中的垃圾回收
asp.net教程:编译错误同时存在于不同dll中
ASP.NET4.0新改进和新特性
ASP教程:防SQL注入
ASP.NET教程:HttpContext类Current属性
在Win2003 IIS 6.0中安装ASP.net环境
asp.net2.0中App_GlobalResources用途
利用Windows系统服务自动更新网站
无缝的缓存读取:双存储缓存策略
WebServices的性能特别慢是真的吗?
ASP.NET MVC的Web应用程序更直观
PHP和ASP.NET代码哪个运行速度更快?
ASP.NET常用代码

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 139 ::
收藏到网摘: 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

登陆 还没注册?