in my page checkboxlist is there .i want to select multiple checkboxes in checkboxlist.after selecting i want to click button.so i want code for store these selected checkbox values into sql server backend table..(code in c#)....in button click
Loading
Niradhip ChakrabortyPosted Dec 3, 2008, 12:04 PM
Say your check box name chkDemo
string strsql = "";
foreach (object obj in chkDemo.CheckedItems)
{
if (strsql.Trim() == "")
{
strsql = "'" + obj.ToString() + "'";
}
else
{
strsql += ",'" + obj.ToString() + "'";
}
}
now whatever you checked in checkbox, I am storing in strsql with comma separator. Now you can store the string in your database. While retrieving from database you can split the string with comma separator and store it in array to use.