Home  »  Articles  »  C#.Net  »

Select Multiple Items in ListBox

 Posted By : Manoj SahooPosted Date : 26/10/2010 06:42:11 AM Category : C#.Net Points : 2

Hello,

To make a multi select listbox follow the below steps :

Step 1 : Create one page and add one ListBox. Set SelectionMode="Multiple"

Step 2 : Now use the below code to read multi selected value into a string variable with ';' as separator.

Code :

int[] indx = ListBox1.GetSelectedIndices();
string str = "";
for (int i = 0; i < indx.Length; i++)
{
    str += ListBox1.Items[indx[i]]+";";
}

Thank you.

Responses
No responses found for this thread. Be the first to respond this thread.
Post Reply
Login to post Response.