tags:

views:

67

answers:

4

What is the easiest way to set the default text selection in a drop down box, and make it so the user cannot select that item? The only way I know currently how to do it, is just manually checking that it isn't checked.

Thanks!

A: 

Set editable to false, and i think if you change the text property you will be able to display a [choose one] type message. Set the list of elements in your drop down box to items in an enumerable, using the enumerable you can protect your input against any programmatic mishaps code to follow.

JERiv
A: 

I think the way you're thinking of is the best way.

You can make it a custom validator if you want though?

McKay
A: 

Just set the Text property to whatever you want, it will not be included in the collection of items. Then, just use SelectedItems.

scottm
A: 

A more difficult, but more elegant, answer would be to set whatever text you wish into the box when it is instantiated ("Select item from this list"), then capture the Click method and populate the box with the new data then, before the user sees it. Your new selection list would replace the original text.

jfawcett