List<String> nameList = new List<String>();
DropDownList ddl = new DropDownList();
Здесь заполняется список, затем сортируется:
nameList.Sort();
Теперь мне нужно добавить его в выпадающий список, где у меня возникают проблемы (используя foreach):
foreach (string name in nameList){
ddl.Items.Add(new ListItem(nameList[name].ToString()));
}
Нет рабочего - есть предложения? Это дает мне ошибки компиляции:
Error - The best overloaded method match for 'System.Collections.Generic.List<string>.this[int]' has some invalid arguments
Error - Argument '1': cannot convert from 'string' to 'int'