I have to display a list of checkboxes (50) from a table A, in this list i have to mark as true boxes that are checked depending on elements in table B. The goal is to have all the 50 checkboxes with those checked. Can you guys help me please.
int envid = int.Parse(txtenvid.Text);
DataView oDvPop = PopulationBL.BigList();
DataView listPop = PopulationBL.SmallListCheckeditems(envid, 1);
CheckBoxList list = new CheckBoxList();
CheckBox check;
CheckBox check2;
for (int i = 0; i < listPop.Count; i++)
{
check = new CheckBox();
check2 = new CheckBox();
check.Text = listPop[i]["POP"].ToString();
for (int j = 0; j < oDvPop.Count; j++)
{
check2.Text = oDvPop[j]["POP_LABEL"].ToString();
if (check.Text == check2.Text)
check.Checked = true;
checkBoxes.Add(check);
chkListPop.Controls.Add(check);
}
}
chkListPop.Controls.Add(check);
Aucun commentaire:
Enregistrer un commentaire