需要帮助的列表框多选

问题描述:

我有一个列表框,里面装满了国家。用户可以在列表框中选择多个国家。需要帮助的列表框多选

<asp:ListBox ID="lstRegion" style="width: 115px;size:3px" runat="server" 
onselectedindexchanged="lstRegion_SelectedIndexChanged" SelectionMode="Multiple" > 
<asp:ListItem Text="Please Select" Value="" Selected="True"></asp:ListItem> 
    </asp:ListBox> 

我需要列表框中的所有选定值。我正在使用lstRegion.selectedValue,但它只给我一个价值。 我尝试了不同的灵魂,运行一个循环到lstRegion中的项目数,并查找是否已选择特定项目。但是这个解决方案对我来说并不好看。

任何一个可以建议我如何让所有selectedvalues在列表框中

List<int>mySelectedIndices = new List<int>(lstRegion.GetSelectedIndices());