设置默认值: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("请选择",""));
posted on 2007-04-23 09:28    阅读(368)  评论(0编辑  收藏  举报