Hy all..I want to ask you how is it possible when a checkbox is checked data from a table is shown based on that checked checkbox.So I have 2 tables: Countries and Cities. I displayed all the countries within a checkboxlist so each country has a checkbox.Now I want when I check a checkbox the cities regarding the country checked to appear.This is my code for displaying the countries:
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["erp"].ConnectionString);
con.Open();
string intero = "Select * from judete";
SqlCommand cmd = new SqlCommand(intero, con);
SqlDataReader rdr;
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
CheckBoxList check = new CheckBoxList();
check.Visible = true;
check.Items.Add(new ListItem(rdr[1].ToString()));
Panel1.Controls.Add(check);
foreach (ListItem item in check.Items)
{
item.Text = rdr.GetString(1);
}
}
My question is: how can i retrieve the cities based on what checkbox is checked? Thanks in advance and sorry for repeating but I didn't figure it out yet.