Hello, today you will learn how to add a default value such as “select a value” to the top of your bound dropdown list in vb.net. I am not going to show you how to bind your dropdown list, you can do that by searching this in google if you do not know how to do this.
After your dropdown list has been bound, you should use the following code after you close your connection to the database.
Dim Item As ListItem = New ListItem
Item.Text = “select a value”
Item.Value = “0″
Item.Selected = True
BoundDropDownList.Items.Insert(0, Item)
Hope this helps.
Leave a Reply