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

log4net配置和使用方法分享

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

ASP.NET2.0服务器控件之Render方法

AjaxControlToolKit DropDownExtender(下拉扩展控件)使用方法

ASP.Net Post方式获取数据流的一种简单写法

ASP.NET中文件上传下载方法集合

ASP.NET中Global和URLReWrite用法

ASP.NET上传文件的简单例子

AjaxControlToolKit CalendarExtender(日历扩展控件)的使用方法

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

精品推荐
分类导航