How to Retrieve checkbox list values from database to textboxes in c#
The value in database is saved with comma like abc,def,ghi..
and I want to retrieve value in checkboxlist
1.Check_abc
2.check_def
3.check_ghi.
The program is in windows application form
Thanks
Loading

Girish Sapariya159 reputationPosted Mar 12, 2014, 9:50 PM EDT
do you want to show 3 check boxes on UI?
Angel Princess100 reputationPosted Mar 12, 2014, 10:26 PM EDT
Girish Sapariya159 reputationPosted Mar 14, 2014, 2:20 AM EDT
Create your checkbox inside the loop.
like this:
for(int i = 0 , i < arr.Length; i++)
{
CheckBox chk = new CheckBox();
chk.Content = "Check_" + arr[i];
//set others propery if required
//add to UI control let say i have a stackpanel in UI with name spCombo
spCombo.Childrens.Add(chk);
}
Hope this will help you: :)
amrik singh2 reputationPosted Mar 14, 2014, 10:43 PM EDT
step1. split your db values and put in arry... use single quote..
step2. loop through the array and add values to the checkboxlist.
string[] newArry=dbvalue.split(',')
//list item need . text and value. right now both r same
checkboxlist.Items.Add(new ListItem(item, item.tostring()));
}
let me know if it did not help , i have full working code that i wont mind to share.
Angel Princess100 reputationPosted Mar 15, 2014, 2:57 AM EDT
Angel Princess100 reputationPosted Mar 15, 2014, 2:57 AM EDT
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Mar 15, 2014, 3:37 AM EDT
Angel Princess100 reputationPosted Mar 17, 2014, 9:28 PM EDT