SqlDataAdapter da1=new SqlDataAdapter("select*from shopleixing",con);
    DropDownList1.Items.Add(new ListItem("全部"));
    DropDownList1.DataSource=ds.Tables["shopleixing"];
    DropDownList1.DataTextField="leixing_zl";
    DropDownList1.DataBind();这是绑定的代码我想手动加上 全部 并且在最上面显示 可是库里的数据将“全部”给覆盖了
 我样怎么做呢

解决方案 »

  1.   

    DropDownList1.Items.Insert(0,new ListItem("全部",""));
      

  2.   

    DropDownList1.Items.Insert(0,new ListItem("全部");
      

  3.   

    SqlDataAdapter da1=new SqlDataAdapter("select*from shopleixing",con);
        
        DropDownList1.DataSource=ds.Tables["shopleixing"];
        DropDownList1.DataTextField="leixing_zl";
        DropDownList1.DataBind();
       DropDownList1.Items.Insert(0,"全部");
       DropDownList1.Items[0].Value="";