Any way to have a ListBox with nothing selected?

  • Thread starter Thread starter MattB
  • Start date Start date
M

MattB

I need to have a control (currently trying to use listbox) where the user
can have nothing selected if they choose. Any way to do that with a list box
or would I be better off with a RadioButtonList? Any other bound controls I
should look into?

Thanks!
 
Usually easiest done by adding an empty item at position zero after binding,
at leat that way the user can select nothing as an option

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
 
Hi, just wondering how to add an empty item at position 0 after data binding as I have a listbox that is currently setup with a databind, after using a stored procedure to fill a dataset?
Thanks.
 
I agree with John on the the empty item for the scenario if a user selects and item and decides to not select something, then the listbox would save that item selected. This would not leave the user a choice unselect their initial choice.
 
With ddlRoutes
.DataSource = travelDB.GetRoutes
.DataTextField = "RouteName"
.DataValueField = "RouteID"
.DataBind()

.Items.Insert(0, New ListItem("-select route-", ""))
End With

HTH,
Greg

Paul said:
Hi, just wondering how to add an empty item at position 0 after data
binding as I have a listbox that is currently setup with a databind, after
using a stored procedure to fill a dataset?
 
Back
Top