Solved

Cascading DropDownList Controls

Posted on 2011-09-28
11
602 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
 
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Form with Modals 16 42
SQL Exceptions 3 36
Pagebreak issue while printing the aspx page 3 14
Automated testing suggestions? 2 22
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now