DropDownList - Sample (vb) of how to do Muliple Linked Together?

D

Dano

I have been away from VB for a while, but now trying to figure out how to
have several DropDownLists on a web page, whereby when I pick a value in the
first list, it will show a narrowed list of choices on the 2nd list, etc.

For example, if on my left hand side, I pick, "Colorado", the box to the
right of it, might list just cities in Colorado

Can anyone point me to an example of doing that....preferably using XML as
the data store of place names, but any examples that show this would be
appreciated.

Thanks in Advance.

Dano
 
N

Nathan Sokalski

I will admit that I have never really done anything with XML, but I have
done what you want to do with DropDownLists using databases, and the idea is
basically the same with XML. Follow these basic steps:

1. Set all but the last of the DropDownLists' AutoPostBack properties to
true.
2. In the SelectedIndexChanged event for these DropDownLists write the code
to clear and repopulate the DropDownLists whose content is dependent upon
the selection of the DropDownList that was changed. When using databases, I
simply generate a Select statement and bind the results to the
DropDownLists, since I have never worked with XML you'll need to figure out
something with an effect on your own.
3. If you are afraid the AutoPostBack technique will cause too many
postbacks or think people would manually ask to have the lists updated (and
sometimes this is the case, you decide what's best in your situation) place
a Button next to each DropDownList that says something like "Update City
List" and place the same type of code in the Button's Click event.

For more help on the XML part of this, you'll need to ask someone else
and/or see some of the other newsgroups (there is at least one for
specifically XML, and the microsoft.public.dotnet.framework.adonet group
might have some good suggestions. Good Luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top