DataTable dt = new DataTable();
DataColumn dc = new DataColumn();
dc.ColumnName = "id";
dc.DataType = typeof(int); //Type.GetType("System.Int32");
dc.AllowDBNull = false;
dc.AutoIncrement = true;
dc.AutoIncrementSeed = 1;
dc.AutoIncrementStep = 1;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.ColumnName = "name";
dc.DataType = typeof(string);
dc.AllowDBNull = false;
dt.Columns.Add(dc);
DataRow row = dt.NewRow();
row["name"] = "zhangsan";
dt.Rows.Add(row);
this.DropDownList1.DataSource = dt;
this.DropDownList1.DataTextField = "name";
this.DropDownList1.DataValueField = "id";
this.DropDownList1.DataBind();
DataColumn dc = new DataColumn();
dc.ColumnName = "id";
dc.DataType = typeof(int); //Type.GetType("System.Int32");
dc.AllowDBNull = false;
dc.AutoIncrement = true;
dc.AutoIncrementSeed = 1;
dc.AutoIncrementStep = 1;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.ColumnName = "name";
dc.DataType = typeof(string);
dc.AllowDBNull = false;
dt.Columns.Add(dc);
DataRow row = dt.NewRow();
row["name"] = "zhangsan";
dt.Rows.Add(row);
this.DropDownList1.DataSource = dt;
this.DropDownList1.DataTextField = "name";
this.DropDownList1.DataValueField = "id";
this.DropDownList1.DataBind();