Need help in listbox multiple select

Posted by vaibhav on Stack Overflow See other posts from Stack Overflow or by vaibhav
Published on 2010-06-02T11:12:07Z Indexed on 2010/06/02 11:13 UTC
Read the original article Hit count: 165

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET