TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Matt Funke
NA
7
1.7k
Can't populate listbox
Jun 14 2011 2:14 PM
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.)
Reply
Answers (
7
)
session time out reg
AutoComplete Extender Doesn't Work...