Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to get the selected value of a list box that has multiple selection enabled. Just the selected items need to get their values.
Posted
Updated 11-May-12 10:18am
v2
Comments
Sergey Alexandrovich Kryukov 8-Mar-12 13:46pm    
What is "ListBob"?
--SA
Member 8317792 8-Mar-12 14:00pm    
List Box **
Sergey Alexandrovich Kryukov 8-Mar-12 18:40pm    
Hm. Did you notice "Improve question" above?
--SA
Member 8317792 11-May-12 16:17pm    
I do now :)

Dude... I also came through certain situation.
But the only change in my case is, it was checklistbox.

If I am not wrong, you must facing problem like,

On selection of list value you need the current selectedvalue,
but you must be getting the first selected value on every selection change...

If this is your problem, I have made a solution for checklistbox on my blog
[http://nadarmuthukumar.blogspot.in/2012/03/get-selected-value-in-checkboxlist_02.html[^]]
You can refer the same, only by changing my checklistbox to listbox
 
Share this answer
 
The ASP.NET class System.Web.UI.WebControls.ListBox does not support multiple selection in the same way as in WPF or System.Windows.Forms.

Please see:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listbox.aspx[^]

For multi-select mode, please see:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listbox.selectionmode.aspx[^].

Locate the section "Examples" and look for the first example. It shows how to work with multiple selection

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900