checking if a list web control contains an item
when setting the selected value in a radiobuttonlist or other list web control in asp.net, it is prudent to check whether the list contains the option you intend selecting first! this avoids those annoying “out of range” error messages. one way of doing this is to use code similar to the following: if not myRadioButtonList.Items.FindByValue("whatever") …