手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >ASP.NET DropDownList控件的使用方法
ASP.NET DropDownList控件的使用方法
摘要:1.数据绑定复制代码代码如下:this.DropDownList1.DataSource=CategoryManager.getCatego...

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 DropDownList控件的使用方法】相关文章:

ASP.NET 页面中加添加用户控件的写法

ASP.NET 重定向的几种方法小结

ASP.NET中Global和URLReWrite用法

asp.net发邮件的几种方法汇总

ASP.NET中用healthMonitor属性用法

asp.net中List的使用方法

ASP.NET用户控件技术

ASP.net中md5加密码的方法

ASP.NET 多次提交的解决办法2

ASP.NET DataTable去掉重复行的2种方法

精品推荐
分类导航