I have a three Checkbox List on my page and I am adding any checked checkbox list Items to a List Box Control. When I remove any item from the List Box, it automatically UN-checks that list item on my checkbox List.
So far I am finding which checkbox list contains that checkbox and it's working. But I don't have an idea how I can uncheck that item which contains that text.
What I have tried so far is shown below:
if (listboxControl.SelectedIndex > 0)
{
string na = listboxControl.SelectedItem.Text;
listboxControl.Items.RemoveAt(listboxControl.SelectedIndex);
var cb1 = CheckBoxList1.Items.FindByText(na);
var cb2 = CheckBoxList2.Items.FindByText(na);
var cb3 = CheckBoxList3.Items.FindByText(na);
if (cb1 != null)
{
//here how i can Uncheck That Item
}
else if (cb2 != null)
{
//here how i can Uncheck That Item
}
else if (cb3 != null)
{
//here how i can Uncheck That Item
}
else
{
}
}
So, the return value of this method will be the required item or null, If it is not
nullthen you can use theSelectedproperty to check/uncheck the item.