如何设置在ASP.NET ListBox中多个选择? [英] How to set multiple selections in ASP.NET ListBox?

查看:116
本文介绍了如何设置在ASP.NET ListBox中多个选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到一个方法来选择一个ASP.NET ListBox中的多个项目背后的code?这是不是需要在Javascript做?

I can't find a way to select multiple items in an ASP.NET ListBox in the code behind? Is this something needs to be done in Javascript?

推荐答案

这是VB code这样做...

this is the VB code to do so...

myListBox.SelectionMode = Multiple
For each i as listBoxItem in myListBox.Items
  if i.Value = WantedValue Then
      i.Selected = true
  end if 
Next

这篇关于如何设置在ASP.NET ListBox中多个选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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