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 89361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:42:16+00:00 2026-05-10T22:42:16+00:00

I have several listboxes that get each of their data from a separate stored

  • 0

I have several listboxes that get each of their data from a separate stored procedure.

If the user selects an option in 1 listbox, it should filter the other listboxes.

I have done this before by adding logic to the stored procedure, but sometimes it seems to get very long.

Does anyone know of a better way to approach this?

The way I have it setup now is that for each ListBox, I have an ObjectDataSource which calls a method that calls a stored proc in the database to populate the listbox.

  • 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. 2026-05-10T22:42:17+00:00Added an answer on May 10, 2026 at 10:42 pm

    You can try changing the code so that instead of having the Listbox bind directly to an ADO.Net datatable, it binds to a DataView. DataViews can be sorted and filtered independently from the underlying DataTable they are based on…

    Assume LBStates is state ListBox, and lbCities is City ListBox, and dtCities is form level DataTable variable with all cities in it and it has a State Column…

         DataView dvCities = dtCities.DefaultView;       dvCities.RowFilter = 'State=' + lbStates.SelectedItem;      lbCities.DataSource = dvCities; 

    Wire up a selectedIndexChanged event to the States ListBox (in initializtion code)

     lbStates.SelectedIndexChanged += lbStates_SelectedIndexChanged; 

    and In the States ListBox SelectedIndexChanged event, add the same code…

      private void lbStates_SelectedIndexChanged(object sender, event e)   {      DataView dvCities = dtCities.DefaultView;       dvCities.RowFilter = 'State=' + lbStates.SelectedItem;      lbCities.DataSource = dvCities;   } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'have several forms that use the same Listboxes. The ListBoxes are populated from a
I have several classes that I serialize/deserialize, each with a number of properties, some
I have several objects, like products, order, etc. When I get information from my
I have a user control that inherits from the ListBox class and displays a
I have a ContextMenuStrip that is assigned to several different listboxes. I am trying
I have two listboxes with several data, ListBox1 have this format: C:\Users\Charlie\Desktop\Trials\Trial0004COP.txt and in
I have several listboxes in a form that I can drag and drop items
I have a listbox that is displaying several attributes from an XML file. How
I have several list boxes in my web application that user has to fill.
I have several winforms listbox controls I am hosting in a user control. The

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.