I have a Form with a DropDownlist with CheckBox inside, and I have an external CheckBox that selects and unchecks all.
My question is the following.
When I unselect one of the items in the DropDown the "Select All" CheckBox should be unchecked and when I select all items it should be checked. But when I do the events are interacting with each other and are giving error.
Does anyone know a way to do this?
This is the CheckBox Select All code.
private void cbSelAll_CheckedChanged(object sender, EventArgs e)
{
if (cbSelAll.Checked == true)
{
//Ao selecionar a flag Selecionar todos marca todos os itens
for (int i = 0; i < cb.CheckBoxItems.Count; i++)
{
cb.CheckBoxItems[i].Checked = true;
}
}
else
{
//Ao desmarcar a flag Selecionar todos desmarca todos os itens
for (int i = 0; i < cb.CheckBoxItems.Count; i++)
{
cb.CheckBoxItems[i].Checked = false;
}
}
}