tags:

views:

54

answers:

1

I have a list box, filled with countries. A user can select multiple countries in the list box.

<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> 

I need all the selected values in the list box. I am using lstRegion.selectedValue but it is giving me only one value. I tried a different soultion, run a loop to the count of items in the lstRegion and find if the particular item has been selected or not. But this solution does'nt look good for me.

Can any one suggest me how to get all selectedvalues in the list box

+2  A: 
List<int>mySelectedIndices = new List<int>(lstRegion.GetSelectedIndices());
Tim Schmelter