Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2004, 11:38 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populate multiple dropdowns without postback?

Hi, I have a webform with four dropdown lists, each of which (apart from the first one obviously) must be populated after a choice is made in the one before it.

I want to avoid postbacks as much as possible as this isn't pleasant for the user (at least not 3 times in a row) - is there a technique (involving
a dataset with multiple tables I would guess) that will allow me to do this without postback?

Example of what I mean:

User chooses "Europe" in first dropdown, and second list instantly only contains countries in Europe, user chooses England, and third list instantly lists only cities in England etc

The dropdowns are of course related at the database end - as I understand it a dataset can contain related tables?

This must be a common requirement, but my searches so far have turned up very little!

Thanks for any help :)

 
Old October 11th, 2004, 12:32 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

I think we can;t populate the value of the dropdown without submitting the page in your case.
We can do this scenario using JavaScript on the client side if we hardcode the country names..

 
Old October 11th, 2004, 12:46 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You can use mutiple tables, however, creating relations won't help unless you post back. In the drop down's SelectedIndex_Changed event, you can loop the the appropriate table(s) and add the values to your dropdown by usingthe ddl<name>.Items.Add method. However, you have to remember to remove the items from the list if any when the index is changed with the ddl<name>.Items.Clear method.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdowns in datagrid amithkiran ASP.NET 1.x and 2.0 Application Design 1 March 24th, 2005 05:33 AM
Three dropdowns, one depended on another. Possible gilgalbiblewheel Classic ASP Databases 2 December 26th, 2004 05:59 PM
Dataview Sort: Multiple Databinds between Postback Machete ASP.NET 1.x and 2.0 Application Design 1 December 10th, 2004 10:05 AM
Code to populate multiple sheet into workbook kud Excel VBA 0 June 9th, 2004 11:37 AM
Can't Populate Multiple Dropdown Lists with DSO nick8245 Javascript 4 September 24th, 2003 08:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.