With a list type control (DropDownList/RadioButtonList, etc.) – you can dynamically select items in the list with a sort of ‘built-in’ find routine. For instance, if you are retrieving an item from a database, and you want to select that item in your list type control, this is the way to do it.

To select a certain item, based on the Value of the item in the list:

myListControl.SelectedIndex = 
myListControl.Items.IndexOf(myListControl.Items.FindByValue(YourValueHere))

To select a certain item, based on the Text of the item in the list:

myListControl.SelectedIndex = myListControl.Items.IndexOf
(myListControl.Items.FindByText(“YourTextHere”))

OR – you can do it this way:

myListControl.Items.FindByText(“TextYouAreLookingFor”).Selected = true

or, using the value of the item:

myListControl.Items.FindByValue(“ValueYouAreLookingFor”).Selected = true

For C#, just add a semi-colon (;) to the end of each line.