We help IT Professionals succeed at work.

Clear listbox selection

Last Modified: 2013-11-07
I have a list box and when I populate it, the first choice is auto selected.  How can I populate the list box, but not have anything selected forcing the user to make the selection?
Watch Question

ListBox? in ASP.net?

Nothing gets selected by default.

But still u get some selected, u can use ListBox1.ClearSelection()


Im using visual basic, but when I populate the list box from an array, the first selection is highlighted.  I dont want this to happen because that causes another process to happen.
Dint this work?



Nope, that will clear the selection I am on, but then will default back to the first selection in the listbox.  I was hoping to not have anything selected until the user clicks on it.
can u post ur code and the aspx of the listbox
Anurag ThakurTechnical Manager

use the selectedindex property of list box and set it to -1 to clear the selection even the default one too
This one is on us!
(Get your first solution completely free - no credit card required)

oooppss.. haven't able to read what ragi0017 posted.

Well, ragi mentioned setting the SelectedIndex = -1  first.

Sorry bro...
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.