471,337 Members | 1,407 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

ListBox Control

MultiSelection not working properly when loading data from a Datatable to a
ListBox. (Unbound)

Works fine when I simply add literal text. Data from the Datatable is
displaying properly in the ListBox.

//this works fine
lbCategories.Items.Add(new ListItem("key1", "value1"));
lbCategories.Items.Add(new ListItem("key2", "value2"));

//this doesn't
foreach (DataRow myRow in currRows)
{
string theValue = (string) myRow["DESCRIPTION"];
string key = myRow["TYPE_ID"].toString();

lbCategories.Items.Add(new ListItem(theValue, key));
}

I am capturing the multiselections in the SelectedIndexChanged of another
listbox.

Again the literals work fine but the load from the DataTable doesn't.

Any idea's?
Jul 21 '05 #1
0 957

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Luca | last post: by
2 posts views Thread by John R. | last post: by
8 posts views Thread by Oddball | last post: by
6 posts views Thread by Chris Leuty | last post: by
18 posts views Thread by Dave Sauny | last post: by
8 posts views Thread by nirdeshonline | last post: by
reply views Thread by crespo | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.