<pre><code>List&lt;String&gt; nameList = new List&lt;String&gt;();
DropDownList ddl = new DropDownList();
</code></pre>

<p>List is populated here, then sorted:</p>

<pre><code>nameList.Sort();
</code></pre>

<p>Now I need to drop it into the dropdownlist, which is where I'm having issues (using foreach):</p>

<pre><code>foreach (string name in nameList){
    ddl.Items.Add(new ListItem(nameList[name].ToString()));
}
</code></pre>

<p>No workie - any suggestions? It's giving me compile errors:</p>

<pre><code>Error - The best overloaded method match for 'System.Collections.Generic.List&lt;string&gt;.this[int]' has some invalid arguments 

Error - Argument '1': cannot convert from 'string' to 'int'
</code></pre>

Why not just bind the DDL directly to the List like
```
```
DropDownList ddl = new DropDownList();
ddl.DataSource = nameList;
ddl.DataBind();
```
```