ba272
asked on
How do I retrieve an object from a listbox?
Hi,
I CAN get the selected item from a listbox without a problem. But I'm having trouble
when I want to get the first item or the second. There are so many methods, yet I can't seem to find the one that's right for me. The content is a string and I'd just like to retrive the string, one by one, for the entir list.
It would be a big help to me if I could solve this ASAP.
Thanks.
I CAN get the selected item from a listbox without a problem. But I'm having trouble
when I want to get the first item or the second. There are so many methods, yet I can't seem to find the one that's right for me. The content is a string and I'd just like to retrive the string, one by one, for the entir list.
It would be a big help to me if I could solve this ASAP.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ListBox lb = new System.Web.UI.WebControls.
// Databind the list here
// Examine the list as below:
foreach (ListItem item in lb.Items)
{
// Here there is read and write access to the following properties
item.Text = "Text value";
item.Value = "Value value";
}