Solved

Cascading DropDownList Controls

Posted on 2011-09-28
11
610 Views
Last Modified: 2012-06-27
Hello Experts,

I have a web application that will be for enrollment for a college. Please see the Steps below in the order that I need the values to appear in the multiple DropDownList Controls.

STEP 1: Select State:
STEP 2: Select City
STEP 3: Select County
STEP 4: Select ZIP

So all controls will need to interact with each other starting from the DropDownList Control in STEP 1 to STEP 4.

I would prefer to NOT have the page PostBack for every DropDownList Selected. I would prefer to use AJAX for ASP.NET if possible.

Also, all the values for each STEP will be in the Database and will need to be ALL related to each other some how and will need to be pulled from the Database. I also plan on using a DataSet with multipe DataTables or one DataTable. What do you prefer I use for storing/retrieving the data??

Thanks in advance!!!
0
Comment
Question by:asp_net2
  • 3
  • 3
  • 2
  • +1
11 Comments
 
LVL 21

Expert Comment

by:Tapan Pattanaik
ID: 36718882
hi asp_net2,

Please check this link. Here is answer to your question.

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx

thanks.
0
 
LVL 18

Expert Comment

by:nap0leon
ID: 36718908
There are a variety of AJAX libraries out there you can use... I presume you already have a library or method in mind and you already have a webpage built that retrieves the data for the input passed in - it returns a list of cities for any STATE that is passed in).

To add this to your page, add an "onChange" function for each drop-down.

State_onChange should use AJAX call to get your City list and then populate the City drop-down list
City_onChange should use AJAX to fetch and populate County list
County_onChange should use AJAX to fetch and populate ZIP list

To handle cases where a user selects values for all then changes STATE, in your AJAX parsing, be sure to accommodate "blank" being passed in so that when State_onChange populates the City list, since the city will initially be blank, the County should be reset to blank which in turn resets ZIP to blank.
0
 
LVL 21

Accepted Solution

by:
Tapan Pattanaik earned 500 total points
ID: 36718936
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Author Comment

by:asp_net2
ID: 36719379
@tapanpattanaik,

Can you take a look at this article below and give me your thoughts on their process and most importantly the performance between this one below and using a webservice? To me I would think using a webservice but be slower. I like the method on the article below but not sure how I could increase the performance if I have 100,000 users +.

http://www.aspsnippets.com/Articles/Creating-Cascading-DropDownLists-in-ASP.Net.aspx

0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 36895382
I have personally used this jQuery  control. It uses ajax to retrieve the cascading values:
http://plugins.jquery.com/project/optiontree
demo: http://blog.kotowicz.net/2009/03/jquery-optiontree-demo.html

I use it in several PHP pages and it can be used in ASP.net. I wrote a GoogleBase taxonomy selector using this and it has up to 8 levels with over 3000 options.
0
 
LVL 4

Author Comment

by:asp_net2
ID: 36898422
@EddieShipman,

My question has to do with interaction to DB and your doesn't mention anything about DB.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 36900817
No, but the control I mentioned uses ajax to obtain values for the second, third, etc drop downs. You would have to write your own scripts to retrieve the values based on your schema.
0
 
LVL 4

Author Comment

by:asp_net2
ID: 36900920
@EddieShipman,

Do you have any tutorials that deal with AJAX using ADO.NET to retrieve data to multiple DropDownList Controls? Also, please no Webservice methods either.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 36903466
Coming from PHP, I can't really explain how to use ajax with ASP.Net. I would think that a regular ASP.Net page with ADO.Net objects retrieving the data and writing it out as JSON would suffice.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question