DropDownList绑定数据表后如果在这个基础上在手工添加一条显示记录
如:库中有某字段 a b c 3条记录,
全部绑定到DropDownList以后,
如何手工为DropDownList添加第一条记录,让DropDownList最终选择记录显示为: 手工绑定 a b c d 4 个可选值出来不知大家理解没有,小菜实在分没有分了最后20分,给10给大家.求解

解决方案 »

  1.   

    你没有说你的数据源是什么不过一般可以使用以下两种办法:
    第一:数据源是dataTableDataTable dt=获取dataTable;
    DataRow dr=dt.NewRow();
    dr["属性名"]="属性值";
    dt.Rows.Add(dr);
    dropDownList1.DataSource=dt;第二:数据源是ListList<Object> list=获取list;
    Object obj=new Object();
    obj.属性名=属性值;
    dropDownList1.DataSource=list;
      

  2.   

     OleDbDataReader sdr = cmd.ExecuteReader(); 
    DropDownList1.DataSource = sdr;
            DropDownList1.DataTextField = "column_name";
            DropDownList1.DataValueField = "id";
            DropDownList1.DataBind();
    我现在的数据绑定是这样的.不过转成datatable后也是个办法,谢谢楼上我先试试
      

  3.   

    this.dropdownlist.appenddatabounditems=true;
    this.dropdownlist.items.add("your data");
      

  4.   

    this.dropdownlist.items.insert(0,"your data");//从第几项中插入数据