A common question that I see posted all over the place is "How can I programmatically select an item in my dropdownlist or listbox based off a certain value?"
It's actually quite simple and here's how to do it:
This is useful when, for example, you're reading values from a DataReader and what to pre-select an option based off of that value.Code:For Each Item As ListItem In MyListBox.Items If Item.Value = "4" Then Item.Selected = True End If Next



LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks