Results 1 to 7 of 7

Thread: [RESOLVED] Selecting specific records from a dropdown box based on another

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    5

    Resolved [RESOLVED] Selecting specific records from a dropdown box based on another

    I am creating an application with html using vb as the back end. Microsoft Visual Studio is the application I am using.

    My question: I have two drop down boxes...one called department, the other program. When a department is selected, I want the program dropdown to only display the programs that are associated with the department chosen. I have found several different codes to do this but nothing has worked so far.

    Can anyone give me a coding example? I am very new to vb coding so please be very explanatory.

    Thanks

  2. #2
    Member
    Join Date
    Jan 2012
    Posts
    46

    Re: Selecting specific records from a dropdown box based on another

    Are you using a database to populate the items in the dropdown list? if so you could just do if statements, I mean hardcode in the first drop down list, then based on there selection, the second one is populated, would be the easiest way I think. A database is the best option I think, esepically if the lists change from time to change.

    after they select the department, an SQL query is run that calls all data associate with that department. May also be able to use JQuery or JavaScript, but I am not all that familiar with these.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    5

    Re: Selecting specific records from a dropdown box based on another

    Yes, the dropdowns are populated from SQL tables. I will try the if statements. Thanks!

  4. #4
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: Selecting specific records from a dropdown box based on another

    Quote Originally Posted by Ryker View Post
    I have found several different codes to do this but nothing has worked so far.
    Can you show us, what have you done so far and what is not working !
    __________________
    Rate the posts that helped you

  5. #5
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Selecting specific records from a dropdown box based on another

    Hello,

    Have a look at the options that I posted in this thread:

    http://www.vbforums.com/showthread.php?t=671300

    Gary

  6. #6

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    5

    Re: Selecting specific records from a dropdown box based on another

    Thanks everybody for your help. I finally got this working. On the html side, I used sql data source for the drop down boxes. In the configuration area of the sql datasource for the dependent drop down box, I added a statement to only pull records where the dept no of the program dropdown (dependent) matched what was displayed in the control of the dept dropdown. Everything is showing up the way it is supposed to now.

    Again thanks for all of your help.

  7. #7
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: [RESOLVED] Selecting specific records from a dropdown box based on another

    Hello,

    For the benefit of other people in the forum, you might want to think about posting your code, that way everyone can learn.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width