In the first level have to disply all the Country in a check box list from the database.
The user is allowed to select any number of Countries and based on those selections
I have to show the States which comes under each Countries in seperate checkbox lists.
The user is allowed to select any number of States and based on these selections
I have to show the disttric of each selected States.
please help to solve it.
i am using following code but its not work proper
MySqlConnection con;
con = new MySqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString());
con.Open();
try
{
for (int i = 0; i < CblistForPravilage.Items.Count; i++)
{
if (CblistForPravilage.Items[i].Selected)
{
string var = string.Empty;
var += CblistForPravilage.Items[i].Value.ToString();
string str = "SELECT * FROM add_state where CID='" + var + "'";
MySqlCommand cmd;
cmd = new MySqlCommand(str, con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
CblistForPravilage0.DataSource = ds;
CblistForPravilage0.DataTextField = "SName";
CblistForPravilage0.DataValueField = "SID";
CblistForPravilage0.DataBind();
}
}
}
}
catch
{
}
}
Deepak SainiPosted Apr 13, 2015, 3:19 AM
1.if you are using the concante your string.so you use in operator.
2.if you use for loop dont be concante your string and pass the checkbox selected value in query and fatch your data.and display your inner checkbox list.
3.you can put your value in session and make a daynamic table and use it last time to display..