you can Sort in the query level itself by order by clause.its good and best practice also, But if you want to sort in the client side here is the function
private void SortDropDown(DropDownList dd)
{
ListItem[] ar = null;
long i = 0;
foreach (ListItem li in dd.Items) {
Array.Resize(ref ar, i + 1);
ar(i) = li;
i += 1;
}
Array ar1 = ar;
ar1.Sort(ar1, new ListItemComparer());
dd.Items.Clear();
dd.Items.AddRange(ar1);
}
Compare class
private class ListItemComparer : IComparer
{
public int Compare(object x, object y)
{
ListItem a = x;
ListItem b = y;
CaseInsensitiveComparer c = new CaseInsensitiveComparer();
return c.Compare(a.Text, b.Text);
}
}