[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
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.
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!
Re: Selecting specific records from a dropdown box based on another
Quote:
Originally Posted by
Ryker
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 !
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
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.
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