关于 DropDownList 循环绑定中遇到的问题

1绑定DataTable 简单直接下部分就ok了

this.DropDownList1.DataSource = DataTable;

this.DropDownList1.DataTextField = "Name";
this.DropDownList1.DataValueField = "id";

this.DropDownList1.DataBind();

但是如果循环绑定就有几个坑

this.DropDownList1.Items.Insert 绑定设置一个请选择还好, 设置多个不介意使用  设置Value和排序显示有时候有冲突

建议使用下面这一种,千万注意写法

this.DDL_Column.Items.Add(new ListItem(name, id));

一定不要再ListItem里面拼接字符串啊,里面不能拼接,这个一个坑

原文地址:https://www.cnblogs.com/Geok/p/7151283.html