List nameList = new List();
DropDownList ddl = new DropDownList();
List is populated here, then sorted:
ddl.DataSource = nameList;
ddl.DataBind();
Doesn't work if it's a SharePoint list - Error: Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource. Decided to chime in, in case any SharePoint developers thought this was for an SPList instead of List
There is a way to bind to an SPList, but you'd use an SPListItemCollection, or go one better and use an SPDataSource. For the SharePoint developers, see this blog by Chris O' Brien.