手机
当前位置:查字典教程网 >编程开发 >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控件的使用方法】相关文章:

利用Timer在ASP.NET中实现计划任务的方法

ASP.net判断上传文件类型的三种有效方法

log4net配置和使用方法分享

web.config使用方法指南

如何在ASP.NET中使用三层架构

ASP.NET 绑定DataSet中的多个表

ASP.NET中用healthMonitor属性用法

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

ASP.NET 回发密码框清空问题处理方法

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

精品推荐
分类导航