用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > Net教程

ASP.NET DropDownList控件的使用方法

时间:2015-01-29  来源:互联网  作者:佚名
1. 数据绑定

复制代码 代码如下:
this.DropDownList1.DataSource = CategoryManager.getCategories();
DropDownList1.DataValueField = "id";//用来设置下拉列表选中的 Value 值
DropDownList1.DataTextField = "name";//为下拉列表选项显示的值
DropDownList1.DataBind();


2.读取数据
复制代码 代码如下:
int categoryId = int.Parse(this.DropDownList1.SelectedItem.Value);//获取下拉列表中选中的值
来顶一下
返回首页
返回首页
推荐资讯
ASP.NET MVC运行出现Uncaught TypeError: Cannot set property __MVC_FormValidation of null的解决方法 ASP.NET MVC运行出现Uncaught TypeChrome提示: 确定相关JS已经包含在页面中,(用的是MasterP
asp.net 通用分页显示辅助类(改进版) asp.net 通用分页显示辅助类(改进版闲暇时重新再看之前很多项目代码的时候,发现很多总是有那么
相关文章
栏目更新
栏目热门