Solved

Cascading DropDownList Controls

Posted on 2011-09-28
11
614 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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?
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

623 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