- 相關(guān)推薦
關(guān)于ASP.NET DropDownList控件的使用方法
1. 數(shù)據(jù)綁定
復(fù)制代碼 代碼如下:
this.DropDownList1.DataSource = CategoryManager.getCategories();
DropDownList1.DataValueField = "id";//用來設(shè)置下拉列表選中的 Value 值
DropDownList1.DataTextField = "name";//為下拉列表選項顯示的值
DropDownList1.DataBind();
2.讀取數(shù)據(jù)
復(fù)制代碼 代碼如下:
int categoryId = int.Parse(this.DropDownList1.SelectedItem.Value);//獲取下拉列表中選中的值
【ASP.NET DropDownList控件的使用方法】相關(guān)文章:
ASP.NET MVC異常處理模塊簡單教程-ASP.NET教程實例推薦07-19
ASP.NET Page函數(shù)調(diào)用解析10-01
早教機(jī)的使用方法07-27
早教機(jī)使用方法02-27
武術(shù)器械使用方法09-03
早教機(jī)藍(lán)牙的使用方法09-16
西餐餐巾的使用方法09-17
護(hù)發(fā)膜使用方法10-26
日語常用敬語使用方法01-21