简体   繁体   English

如何在 C# 中获取多选下拉列表的所有选定值

[英]How to get all selected values of multiselect dropdown in C#

How to get all selected values of multi select dd in C#如何在 C# 中获取多 select dd 的所有选定值

Let's suppose I have a multi combo box and in which i have selected 3 values out of 5 values.假设我有一个多组合框,并且我从 5 个值中选择了 3 个值。 So how could I fetch the selected Values only.那么我怎样才能只获取选定的值。

A friendly question, is it really a combobox you are using?一个友好的问题,您使用的真的是 combobox 吗? Most comboboxes/dropdownlists I have come across supports only singleselect.我遇到的大多数组合框/下拉列表仅支持单选。 Even stack overflow tag suggests the same:甚至堆栈溢出标记也暗示相同:

在此处输入图像描述

Is it instead a listview or something simelar, these controlls often has SelectedIndices and/or SelectedItems.它是列表视图还是类似的东西,这些控件通常具有 SelectedIndices 和/或 SelectedItems。 It also has boolean property "MultiSelect" to support single or multiselect.它还具有 boolean 属性“MultiSelect”以支持单选或多选。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM