如何获取列表框中所选项目的值 [英] How to get the values of selected items in ListBox

查看:456
本文介绍了如何获取列表框中所选项目的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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


这篇关于如何获取列表框中所选项目的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆