yissyo的应该可以!
既然有value,有text. 一个string怎么够呢! 你可以把value和text封装成一个类(class1)嘛! 对应的给个属性Value和Text!
List
ddl.DataSource = cList;
ddl.DataTextField = cList.Value;
ddl.DataValueField = cList.Text;
ddl.DataBind();
List
List
datas1.Add("abc");
datas2.Add("123");
datas2.Add("1bd");
Dictionary
for (int i = 0; i < datas1.Count && i < datas2.Count; ++i)
{
dic.Add(datas1[i], datas2[i]);
}
DropDownList1.DataSource = dic;
DropDownList1.DataTextField = "Key";
DropDownList1.DataValueField = "Value";
DropDownList1.DataBind();
List
考虑用Dictionary
Dictionary
dic.Add("1", "Monday");
dic.Add("2", "Tuesday");
ddl.DataSource = dic;
ddl.DataTextField = "Value";
ddl.DataValueField = "Key";
ddl.DataBind();