Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have list of student id values in listbox.

In listbox student id as follows

10
20
30
40
50
60
70


i want to store the above listbox values into string.

Regards,
Narasiman P.
Posted

 
Share this answer
 
You can bind it in string like this

C#
string listData = string.Empty;
         
            foreach (object item in listBox1.Items)
            {
                listData = item.ToString() + "," + listData;
                
            }
            Response.Write(listData);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900