Here's the relevant C#:
List<string> emailChoices = new List<string>();
string emailPermissionsTable = "EmailPermissions";
sqlConn.ConnectionString = sqlConnStr;
sqlConn.Open();
sqlComm.Connection = sqlConn;
sqlComm.CommandText = "SELECT * FROM " + emailPermissionsTable + " WHERE Username = '" + user + "';";
sqlDr = sqlComm.ExecuteReader();
emailChoices.Clear();
while (sqlDr.Read())
{
string emailAddy = sqlDr["EmailRecipient"].ToString();
emailChoices.Add(emailAddy);
}
emailListBox.DataSource = emailChoices;
emailListBox.DataBind();
... and the relevant code-behind:
<asp:ListBox ID="emailListBox" Width="200px" runat="server"></asp:ListBox>
I can verify that the emailChoices list is being populated correctly. Why aren't the list elements showing up in the listbox? What have I missed? (Even if I look at the page source, it doesn't seem that the list is being loaded.)