|
-
Jan 31st, 2012, 12:47 PM
#1
Thread Starter
New Member
[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
-
Jan 31st, 2012, 01:08 PM
#2
Member
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.
-
Jan 31st, 2012, 02:07 PM
#3
Thread Starter
New Member
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!
-
Feb 1st, 2012, 12:22 AM
#4
Re: Selecting specific records from a dropdown box based on another
 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 !
__________________
Rate the posts that helped you 
-
Feb 1st, 2012, 03:22 PM
#5
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
-
Feb 3rd, 2012, 10:16 AM
#6
Thread Starter
New Member
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.
-
Feb 3rd, 2012, 03:51 PM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|