I am doing a data bind to a check box, So I display 6 values in my check box, and users are given 2 random values when they are created. How can I check the values in the check box after I do the databind. If value 2 and 4 are give for a user then the check box should display 1 to 6 which I am doing using databind and I have to check 2 and 4 value how can I do that
while (reader.Read())
{
rolegiven.Add(reader["RoleName"].ToString());
}
reader.Close();
if (rolegiven.Any(item => item.Equals("Value1")))
{
ckl_EditRole.SelectedIndex = 0;
}else{}
if (rolegiven.Any(item => item.Equals("Value2")))
{
ckl_EditRole.SelectedIndex = 1;
}else{}
if (rolegiven.Any(item => item.Equals("Value3")))
{
ckl_EditRole.SelectedIndex = 2;
}else{}
If value 2 and 3 are selected( from Databinding I find that value2 and value 3 are given for the user) only value 3 is checked. How can I do this
You have to use
Itemscollection ofCheckBoxListcontrol.