How to select the multiple items in list box and that will store the Database
The code which I write here is ASP.NET with C#.net
This problem is easy to do.
First you take one LIstbox controll then go to its properties
then
make it as it follow
Selection mode= "Multiple "
then
write the following where you want
string str =null ;
for (int i = 0; i < ListBox2.Items.Count; i++)
{
if (ListBox2.Items[i].Selected == true)
{
str+= ListBox2.Items[i].Text.ToString();
str += ",";
}
}
if you want to store the database
"insert into sampletable values (' "+ str+" ')",cn);
(here cn means connection string which is used to connecthe database )
Mail to Shravan.1258@yahoo.com
No comments:
Post a Comment