ASP.NET控件--DropDownList

 
设置默认值:DropDownList1.Items[i].Selected=true;
绑定:
DropDownList1.DataSource = dataSet.Tables["Table1"].DefaultView; 

//指定DropDownList使用的表里的那些字段 

DropDownList1.DataTextField = "ItemName"; //dropdownlist的Text的字段 

DropDownList1.DataValueField = "id";//dropdownlist的Value的字段 

DropDownList1.DataBind(); 
取选择项:
DropDownList1.SelectedItem.Value()不要()   
    
  OracleCommand   myCommand11   =   new   OracleCommand("select   jh,cw,scts,ny,bj   from   dba04   where   jh="+DropDownList1.SelectedItem.Value,   myConnection);   
加个空选项
this.DropDownList1.Items.Insert(0,new   ListItem("请选择",""));
=============================================================
作者:Elaine
交流QQ:392989505
原文地址:https://www.cnblogs.com/ITGirl00/p/3485359.html