I have three dependant checkboxlists. 1. Countries 2. States 3. Cities I want to list all the States if the particular Country is selected in the Countries checkboxlist. And similarly if i select any State then the respective Cities should be populated in the cities checkboxlist.
I have created separate functions for States for every Country and calling them with the following code:
private void Country_SelectedIndexChanged(object sender, EventArgs e)
        {
            foreach (string s in Country.CheckedItems)
            {
                if (Country.CheckedItems.Contains("US"))
                {
                    US_States_Checked();
                }
                if (Country.CheckedItems.Contains("Canada"))
                {
                    Canada_States_Checked();
                }
            }
        }
public void Canada_States_Checked()
        {
            string[] canada_states = new string[12];
            canada_states[0] = "Alberta";
            canada_states[1] = "British Columbia";
            canada_states[2] = "Manitoba";
            canada_states[3] = "New Brunswick";
            canada_states[4] = "Newfoundland and Labrador";
            canada_states[5] = "Northwest Territories";
            canada_states[6] = "Nova Scotia";
            canada_states[7] = "Ontario";
            canada_states[8] = "Prince Edward Island";
            canada_states[9] = "Quebec";
            canada_states[10] = "Saskatchewan";
            canada_states[11] = "Yukon Territory";
            State.Items.AddRange(canada_states);
        }
I have the following problems: 1. Which property is used for detecting when the checkbox is UnChecked? 2. How to make a check on the name of selected state/country and check whether it is Checked or Not? Something like:
if(country.selectedItem.Equals("US") and country.selectedItem is unchecked....)) {
.......
} 
- How to remove/clear the particular states/cities when the country is unchecked keeping in mind that it shouldn't remove the states of any other country listed in the states checkboxlist?
Problem is simple but a bit tricky.
Thanks
 
     
    