473,587 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dependent Dropdown Lists in C#

I am trying to find a way to create dependent dropdown lists in C# The old
way I knew involved javascript and will no longer work in the new design. I
need for each list to be database driven (data is pulled from database)

Example:
First Box would have Years 2004, 2003, 2002, 2001, etc.
Second Box: would have Ford, Chevy, Dodge, Toyota, Honda, etc
Third Box would have items based from first selelction(if Ford chosen)
F-150, Explorer, Bronco, etc

Does anyone have any thought on how this can be accomplished, I have stumped
all my fellow coworkers.

Thanks
Nov 22 '05 #1
2 3971
Hi Tony,

Are you saying you want to avoid a postback event and dump all data onto the client and then sort
from there using javascript?
If so you can just registerscript using a couple of different methods as outlined here:

http://msdn.microsoft.com/library/de...sidescript.asp
Otherwise i would say just define an OnSelectedIndex Changed event with autopostbackack enabled on
the second cbo, handle that on the server and then fill the third combos datasource from the db
depending on the selected value of the second cbo. However if you've stumped all your co workers
then im inclined to wonder if this is too simplistic and not what you want?

Richard
"Tony Grider" <To********@dis cussions.micros oft.com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
I am trying to find a way to create dependent dropdown lists in C# The old
way I knew involved javascript and will no longer work in the new design. I
need for each list to be database driven (data is pulled from database)

Example:
First Box would have Years 2004, 2003, 2002, 2001, etc.
Second Box: would have Ford, Chevy, Dodge, Toyota, Honda, etc
Third Box would have items based from first selelction(if Ford chosen)
F-150, Explorer, Bronco, etc

Does anyone have any thought on how this can be accomplished, I have stumped
all my fellow coworkers.

Thanks

Nov 22 '05 #2
Thank you Richard for the reply, Im looking at the link currently to see if
this is what I needed.

If there are other suggestions as well they would be greatly appreciated as
well

"Richard Myers" wrote:
Hi Tony,

Are you saying you want to avoid a postback event and dump all data onto the client and then sort
from there using javascript?
If so you can just registerscript using a couple of different methods as outlined here:

http://msdn.microsoft.com/library/de...sidescript.asp
Otherwise i would say just define an OnSelectedIndex Changed event with autopostbackack enabled on
the second cbo, handle that on the server and then fill the third combos datasource from the db
depending on the selected value of the second cbo. However if you've stumped all your co workers
then im inclined to wonder if this is too simplistic and not what you want?

Richard
"Tony Grider" <To********@dis cussions.micros oft.com> wrote in message
news:98******** *************** ***********@mic rosoft.com...
I am trying to find a way to create dependent dropdown lists in C# The old
way I knew involved javascript and will no longer work in the new design. I
need for each list to be database driven (data is pulled from database)

Example:
First Box would have Years 2004, 2003, 2002, 2001, etc.
Second Box: would have Ford, Chevy, Dodge, Toyota, Honda, etc
Third Box would have items based from first selelction(if Ford chosen)
F-150, Explorer, Bronco, etc

Does anyone have any thought on how this can be accomplished, I have stumped
all my fellow coworkers.

Thanks


Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2580
by: Toonman | last post by:
I have a webpage with a <form> consisting of a large table grid of dropdown lists used to make changes in a database. Some of these dropdown lists have the same value. I'm trying to make it so that when a user mouses over one of the dropdown lists, that dropdown list, and all other dropdown lists having that same value are highlighted with a...
2
495
by: Tony Grider | last post by:
I am trying to find a way to create dependent dropdown lists in C# The old way I knew involved javascript and will no longer work in the new design. I need for each list to be database driven (data is pulled from database) Example: First Box would have Years 2004, 2003, 2002, 2001, etc. Second Box: would have Ford, Chevy, Dodge, Toyota,...
0
2066
by: Mike O. | last post by:
MS Access 2003 "filter by form" has drop down lists that allow the user to select values for each field to filter by. However, once some values are selected,the remaining dropdown lists remain the same and aren't progressively filtered to reflect the selections already made in other fields. This can be very tedious when filtering a large...
0
1781
by: Henke | last post by:
Hi, I have done some research about my problem I have when using the "back button" in IE to go back to a page with two dropdown lists. The both dropdown lists are populated with data. The first dropdown lists is redirecting the user to another page (building a querystring for the second page to use) and when the back button
6
10671
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. Let's say you select 1 of the items, and are properly redirected. You press the back button. I have three servers providing two different...
1
1394
by: Hifni Shahzard | last post by:
Hi, I'm using VS.NET 2003, SQL Server 2000, Windows xp professional; My Question: Some of you might seen in some websites where it requests the Country in a dropdown. If the Country selected, it gives all States of that Country in an another Dropdown called States. For Example if I selected my country as England, it gives all the states in...
5
1862
by: Bels | last post by:
I am currently designing a real estate website using Dreamweaver CS3, php, MySQL on a Mac. On it is a 'property search' form that queries the property database. The form consists of 5 dropdown lists. The first dropdown (buy or let) is a parent list and the 3rd and 4th dropdowns (minimum price and maximum price) are child lists - they are dependent...
3
6216
by: pugalenthi | last post by:
I have created a dropdown box which is populated by data from the mssql server database connected using ODBC. Now i need to populate another dropdown box which will also be from the database but will be based on the value selected in the already created dropdown box. The following is how i have created a dropdown box, $sql_visitor= "SELECT...
1
2028
by: kanimozhiz | last post by:
Hi, I am using dropdown lists. What I need is on the selection of one item in one dropdown list, the second dropdown list should get populated accordingly. can anyone tell me how to do this in C# .net coding.... regards kani
3
2782
by: John | last post by:
I have two dropdown lists that I have bound to a datatable and set the DataTextField and DataValueField for. Both lists show the values I expect from the database. However, when I need to access the valueField for a dropdown list I always get the first value. Here is my code I do on load to bind the dropdowns: Try 'load the Division...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.