倒是有这个属性:
                 this.ASPxComboBox6.ValueField = car_num;
                this.ASPxComboBox6.TextField = car_num;但是提示错误:无法将类型“System.Collections.Generic.List<string>”隐式转换为“string”
要崩溃了,处处有问题

解决方案 »

  1.   

    this.ASPxComboBox6.DataSource指定了3次,这样做有什么必要么
    还有,ASPxComboBox6到底是个什么控件,我一直以为是combobox,难道不是??
      

  2.   

     car_num 是 List<string> 类型的,不能赋值给TextField!!! 它接收的是一个字符串类型的,就是要显示的字段名称,你搞一个list集合,实在是牛头不对马嘴。
      

  3.   

    car_num是数据库里的字段名,刚发现和List<string> car_num = new List<string>()这里的重复了,把List<string> car_num = new List<string>()改成了List<string> carnum_list = new List<string>()   但也不能直接写字段名啊,不识别,怎么给引出来?
      

  4.   

     this.ASPxComboBox6.DataSource = ds.Tables[0];
      

  5.   

    this.ASPxComboBox6.ValueField = "car_num";
                    this.ASPxComboBox6.TextField = "car_num";
    就行了
    它就要个字符串,就是dt里的列名叫什么
      

  6.   

    The DataSourceID property of 'ASPxComboBox6' must refer to an existing control.  There is no control with the specified ID: '(无)'.
    这个错误怎么改
      

  7.   

     this.ASPxComboBox6.ID  = "";这个去掉
    你没事修改人家ID干吗,还给改成空字符串了
      

  8.   

    去掉了,也不行。//绑定数据源
              this.ASPxComboBox6.DataSourceID = null;
               this.ASPxComboBox6.ID  = "";           this.ASPxComboBox6.DataSource = ds.Tables["contents"].DefaultView;
               this.ASPxComboBox6.ID  = "id";           this.ASPxComboBox6.DataBind();
    把这段都去掉了,也不行。
      

  9.   

     protected void ASPxComboBox6_TextChanged(object sender, EventArgs e)
        {          string NumDrop = this.ASPxComboBox6.Text.Trim();         
              string carnum_query = "SELECT   car_num, car_type, driver, tel, id FROM dbo.diaodu_car_base WHERE car_num LIKE '%" + NumDrop + "%'";
            //Response.Write(carnum_query);          string strConnnection = System.Configuration.ConfigurationManager.ConnectionStrings["emailConnectionString"].ConnectionString;
              SqlConnection con = new SqlConnection(strConnnection);          //创建OleDbDataAdapter对象,按照指定的查询语句获取结果
              SqlDataAdapter cmd = new SqlDataAdapter(carnum_query, con);          //定义DataSet对象,将查询结果填充到这个对象上
              DataSet ds = new DataSet();
              cmd.Fill(ds, "contents");
         
                     if (con.State == ConnectionState.Closed)
                     {
                         con.Open();
                     }
                  
                     List<string> carnum_list = new List<string>();
                     foreach (DataRow row in ds.Tables[0].Rows)
                     {
                         foreach (DataColumn column in ds.Tables[0].Columns)
                         {
                             carnum_list.Add(row[column].ToString());
                         }
                     }
                     int index=0;
                     for (int i = 0; i < carnum_list.Count; i++)
                     {
                         if (carnum_list[i] == NumDrop)
                         {
                             index = i;
                           
                         }
                     }
                     this.ASPxComboBox6.DataSource = carnum_list;             
                     this.ASPxComboBox6.SelectedIndex = index ;
                    this.ASPxComboBox6.ValueField = "car_num";
                    this.ASPxComboBox6.TextField = "car_num";
                   
                 }
    运行提示错误:The DataSourceID property of 'ASPxComboBox6' must refer to an existing control.  There is no control with the specified ID: '(无)'.