public void BindDropDownList() { CategoryDAL cd = new CategoryDAL(); ddlProductCate.DataSource = cd.GetList(""); ddlProductCate.DataTextField = "CateName"; ddlProductCate.DataValueField = "CateID"; ddlProductCate.DataBind(); //需要在最后一行,在绑定数据的后面 ddlProductCate.Items.Insert(0, new ListItem("请选择一个类别", "")); }
需要写在绑定数据之后