Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7663055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:57:32+00:00 2026-05-31T13:57:32+00:00

Hy all..I want to ask you how is it possible when a checkbox is

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:57:33+00:00Added an answer on May 31, 2026 at 1:57 pm

    what you should do is:

    1. make your checkboxlist autopostback property set to true
    2. on the event SelectedIndexChanged of checkboxlist write your code to retrieve the cities of the checkeditem and display them whereveer you want.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello all I am working in javascript and html5.I want to ask that how
hihi i have a question that i want to ask about c# and window
Possible Duplicate: Javascript scoping variables theory Hi all, I want to ask something stranger.
I want to ask a question about the SQL. I have the following table.
Hello all I am working on javascript jquery and svg.I want to ask a
All I want to do is return the index of the i that is
I don't know if its possible but just want to ask if we can
Hi I would like to ask if its possible get array with clear data
I want to ask is it possible to insert your own value in the
I'm new to zend framework and I want to ask if is it possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.