日期:2014-05-20  浏览次数:20827 次

如何把DropDownList的空白值放在最前面
我如何把一个空白值放在最前面 txtCityName.Items.Add(new ListItem("", ""));  

SqlConnection conn = new SqlConnection(@"uid=sa; pwd=123456; server=OURWAY-PC011\WANGHUA;database=tudi");
  SqlCommand cmd = new SqlCommand("select * from AADA02TB", conn);
  SqlDataAdapter adpt = new SqlDataAdapter(cmd);
  DataTable dtable = new DataTable();
  adpt.Fill(dtable);
  txtCityName.DataSource = dtable;
  txtCityName.DataTextField = "CityName";
  txtCityName.DataValueField = "CityCode";
  txtCityName.DataBind();
  adpt.Dispose();
  cmd.Dispose();
  conn.Close();
  txtCityName.Items.Add(new ListItem("", ""));

------解决方案--------------------
C# code
ddl.Items.Insert(0, new ListItem("Not Select", "-1"))