If your data is in an array, then this approach will work:
string[] data = new string[] {"zzz", "yyy", "bbb", "ccc", "aaa", "xxx"};
Array.Sort(data);
_dropDownList.DataSource = data;
_dropDownList.DataBind();
If your data is in a DataTable/DataSet:
DataSet ds = GetDataSetFromDatabase();
DataView dv = new DataView(ds.Tables["TheTable"]);
dv.Sort = "MyColumn";
_dropDownList.DataSouce = dv;
_dropDownList.DataBind();
-Brock
DevelopMentor
http://staff.develop.com/ballen I have a ListBox Control for which I would like to sort the ListItems.
What is the best way to do this? If possible, can someone show me a
simple example? Any help would be appreciated. Thanks.