Solved

Cascading DropDownList Controls

Posted on 2011-09-28
11
608 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to count occurrences of each item in an array.

838 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