SortedList对象

SortedList 对象优点:可按照字符顺序或数字顺序自动地对项目进行排序。

代码如下:

SortedList sl = new SortedList();
sl.Add("a", "企业");
sl.Add("c", "请选择");
sl.Add("b", "管理员");

DropDownList1.DataSource = sl;
DropDownList1.DataValueField = "Key";
DropDownList1.DataTextField = "Value";
DropDownList1.DataBind();

 

posted on 2015-01-14 00:30  kime  阅读(172)  评论(0)    收藏  举报