如何获取列表框中所选项目的值

问题描述:

如何获取已启用多项选择的列表框的选定值.只是选定的项目需要获取它们的值.

How to get the selected value of a list box that has multiple selection enabled. Just the selected items need to get their values.

Dude ...我也遇到了某些情况.
但是在我的情况下,唯一的变化是复选框.

如果我没有记错,您必须面对类似的问题,

选择列表值时,需要当前选择的值,
但是您必须在每次选择更改时都获得第一个选定的值...

如果这是您的问题,我已经在我的博客上为清单框提供了解决方案
[ ^ ]]
您只能通过将我的复选框更改为列表框来引用相同的内容.
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


ASP.NET类System.Web.UI.WebControls.ListBox不支持与WPF或System.Windows.Forms中相同的多重选择. br/>
请参阅:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listbox.aspx [ ^ ]

有关多选模式,请参见:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listbox.selectionmode.aspx [
—SA
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