Selecting an item in a DropDownList by value
Wow, this drove me insane today. You would think there would be an easier way but I don't know of any. We were trying to select an item in a DropDownList by it's value rather than by it's index because the index isn't known most of the time, ie when you get a DataSet from the database to populate the DropDownList. So here it is:
DropDownList1.Items.FindByValue(MyValue).Selected =
true;
I hope that helps any of you trying to do the same thing. If anyone knows of a better way let me in on your secret.