I don't understand some things about setting the current selection of dropdownlists from code.
I have a dropdown list of people's names where the Value is a Person_ID. This gets loaded from SQL, and I added an Item which is "Please select..." to the top of the list and gave it a value of 0. AppendDataBoundItems is true.
If I want to select an item from code can I use dropdownlist.SelectedValue=8 (for example)?
Do I also have to set the SelectedItem.Text or does tha above do that for me?
Can I instead set the SelectedIndex to some number if I happen to know it? Will that set the SelectedValue and SelecteItem for me?
If I want to set the list back so that nothing is selected (and Please select... shows) should I set SelectedIndex=0?
Is that the same as setting SelectedValue=0 in this case (since "Please select" has a value of 0)?
I guess I'm confused on which of these 3 properties I should be using, to select an item (or deselect all items) in the list, using code.
View Complete Post