jeudi 12 mars 2015

Add default Item to data bound ComboBox

I have a function that brings back a datatable [GetDrinks()]


I use the function to populate a data source.


I want add a default value 'Select Drink' but it doesn't seem to work as it only shows the values form the datagrid.


Any ideas to get around this?



cboDrinks.DataSource = GetDrinks()
cboDrinks.DisplayMember = "Drink_DESCN"
cboDrinks.ValueMember = "Drink_ID"

cboDrinks.Items.Insert(0, " Select Drink ")
cboDrinks.SelectedIndex = 0

Aucun commentaire:

Enregistrer un commentaire