绑定DropDownList控件

来源:互联网 发布:淘宝上架商品没有品牌 编辑:程序博客网 时间:2024/05/01 13:24

string sql = "select id,SZQX from tb_city";
        Database db = new Database();
        DataTable dt = db.GetDataTable(sql);
        DropDownList1.DataSource = dt;
        DropDownList1.DataTextField = "SZQX";
        DropDownList1.DataValueField = "id";
        DropDownList1.DataBind();
        DropDownList1.Items.Insert(0, new ListItem("请选择...", "0"));

原创粉丝点击