473,379 Members | 1,283 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

arraylist..or..hashtable...how to....

I have the following information

continent | country | Placeof interest

Asia | India |agra,mumbai,delhi
asia | china |beijing,shangai,shen zhen
asia | mongolia | ulan bator
North america | USA | new york,losangeles,boston
north america | canada | ottowa,toronto
south america | brazil | sao palo,rio de janiro
south america | argentina | comodoro,beusnoair

i want to create an aspx page that would read the data from my
collection object and populate the dropdowns

dropdown 1 - continent

dropdown 2 - country

dropdown 3 - places of interest

so if i change asia,it should show india,china,mongolia ..in the second dropdown..if i select
india then ythe 3rd dropdown should show all the places in india
alone.
thanx in advance!!
Feb 27 '07 #1
3 1082
vijaydiwakar
579 512MB
I have the following information

continent | country | Placeof interest

Asia | India |agra,mumbai,delhi
asia | china |beijing,shangai,shen zhen
asia | mongolia | ulan bator
North america | USA | new york,losangeles,boston
north america | canada | ottowa,toronto
south america | brazil | sao palo,rio de janiro
south america | argentina | comodoro,beusnoair

i want to create an aspx page that would read the data from my
collection object and populate the dropdowns

dropdown 1 - continent

dropdown 2 - country

dropdown 3 - places of interest

so if i change asia,it should show india,china,mongolia ..in the second dropdown..if i select
india then ythe 3rd dropdown should show all the places in india
alone.
thanx in advance!!
i'll defenetly solve thy prob but just give me some time
Feb 27 '07 #2
AricC
1,892 Expert 1GB
I have the following information

continent | country | Placeof interest

Asia | India |agra,mumbai,delhi
asia | china |beijing,shangai,shen zhen
asia | mongolia | ulan bator
North america | USA | new york,losangeles,boston
north america | canada | ottowa,toronto
south america | brazil | sao palo,rio de janiro
south america | argentina | comodoro,beusnoair

i want to create an aspx page that would read the data from my
collection object and populate the dropdowns

dropdown 1 - continent

dropdown 2 - country

dropdown 3 - places of interest

so if i change asia,it should show india,china,mongolia ..in the second dropdown..if i select
india then ythe 3rd dropdown should show all the places in india
alone.
thanx in advance!!
You want linked combo boxes dependent on selection? Where is the data coming from? You need to at least make an attempt at the code. Please post what you have so far.
Feb 27 '07 #3
vijaydiwakar
579 512MB
I have the following information

continent | country | Placeof interest

Asia | India |agra,mumbai,delhi
asia | china |beijing,shangai,shen zhen
asia | mongolia | ulan bator
North america | USA | new york,losangeles,boston
north america | canada | ottowa,toronto
south america | brazil | sao palo,rio de janiro
south america | argentina | comodoro,beusnoair

i want to create an aspx page that would read the data from my
collection object and populate the dropdowns

dropdown 1 - continent

dropdown 2 - country

dropdown 3 - places of interest

so if i change asia,it should show india,china,mongolia ..in the second dropdown..if i select
india then ythe 3rd dropdown should show all the places in india
alone.
thanx in advance!!
Yeh......!
I'm with the solution right now
u've to use xmlfiles for that
as
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Imports System.Xml
  4. ' Place 3 comboboxes rename them as
  5. ' cmbContinantal,cmbCountry,cmbPlaces
  6. Public Class Form1
  7.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  8.         CreateXml()
  9.     End Sub
  10.     Private Sub CreateXml()
  11.         Dim myXml As New XmlTextWriter("c:\myxml.xml", System.Text.Encoding.UTF8)
  12.         With myXml
  13.             .Formatting = Formatting.Indented
  14.             .WriteStartElement("myXml")
  15.  
  16.             ' any how 0 must not be changes u may increase upto n no. 
  17.             'but do not increase that 0
  18.             .WriteStartElement("Continant")
  19.             .WriteAttributeString("Count01", "Asia")
  20.             .WriteAttributeString("Count02", "Africa")
  21.             .WriteEndElement()
  22.  
  23.             .WriteStartElement("Country")
  24.             .WriteAttributeString("Asia01", "India")
  25.             .WriteAttributeString("Asia02", "China")
  26.             .WriteAttributeString("Africa01", "SA")
  27.             .WriteAttributeString("Africa02", "WI")
  28.             .WriteEndElement()
  29.  
  30.             .WriteStartElement("Places")
  31.             .WriteAttributeString("India", "Mumbai|Delhi|Nagpur")
  32.             .WriteAttributeString("China", "beging|China2|China3")
  33.             .WriteAttributeString("SA", "sa1|sa2|sa3")
  34.             .WriteAttributeString("WI", "wi1|wi2|wi3")
  35.  
  36.             .WriteEndElement()
  37.             .Flush()
  38.             .Close()
  39.         End With
  40.     End Sub
  41.  
  42.     Private Sub cmbContinantal_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbContinantal.DropDown
  43.         SetCombosAsPer("Continant")
  44.     End Sub
  45.  
  46.     Private Sub cmbContinantal_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbContinantal.SelectedIndexChanged
  47.         SetCombosAsPer("Country")
  48.     End Sub
  49.     Private Sub SetCombosAsPer(ByVal sCondition$)
  50.         Dim Doc As New XmlDocument
  51.         Doc.Load("C:\myxml.xml")
  52.         Dim myNodelist As XmlNodeList
  53.         myNodelist = Doc.GetElementsByTagName(sCondition)
  54.         Dim myNode As XmlNode
  55.         For Each myNode In myNodelist
  56.             Select Case myNode.Name
  57.                 Case "Continant"
  58.                     cmbContinantal.Items.Clear()
  59.                     For i As Int16 = 0 To myNode.Attributes.Count - 1
  60.                         cmbContinantal.Items.Add(myNode.Attributes(i).Value)
  61.                     Next
  62.                 Case "Country"
  63.                     cmbCountry.Items.Clear()
  64.  
  65.                     For i As Int16 = 0 To myNode.Attributes.Count - 1
  66.                         ' here 0 is concanated to avoid error.
  67.                         'If u think how then go 3 step later and think
  68.                         If myNode.Attributes(i).Name.Substring(0, InStr(myNode.Attributes(i).Name, "0")) = cmbContinantal.Text & "0" Then
  69.                             cmbCountry.Items.Add(myNode.Attributes(i).Value)
  70.                         End If
  71.                     Next
  72.                 Case "Places"
  73.                     cmbPlaces.Items.Clear()
  74.                     Dim myCities() As String
  75.                     For i As Int16 = 0 To myNode.Attributes.Count - 1
  76.                         If myNode.Attributes(i).Name = cmbCountry.Text Then
  77.                             myCities = myNode.Attributes(i).Value.ToString.Split("|")
  78.                             For j As Int16 = 0 To UBound(myCities)
  79.                                 cmbPlaces.Items.Add(myCities(j))
  80.                             Next
  81.                         End If
  82.                     Next
  83.             End Select
  84.         Next
  85.     End Sub
  86.  
  87.     Private Sub cmbCountry_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbCountry.SelectedIndexChanged
  88.         SetCombosAsPer("Places")
  89.     End Sub
  90. End Class
  91.  
  92.  
try it
Feb 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Matthias Kwiedor | last post by:
Hi@all! I have a app (c#) where i load up a external dll (managed code from c#) with a small arraylist and hashtable in two routines (about 40000 objects in each arraylist and hashtable). If...
6
by: Dan V. | last post by:
I would like to create a 2D string list (2D ArrayList ???). I would like to pass in a table or query as a parameter and have both columns transform into a 2D ArrayList. When I sort the one...
5
by: Matthias Kwiedor | last post by:
Hi! What i want to do, is to put an ArrayList into a Hashtable. So i can access the ArrayList fast over the key-indexing of the Hashtable. What i did is to put the ArrayList into the...
5
by: Netmonster | last post by:
Hello, Does any one have an example of how to create an ArrayList of objects? i.e. ArrayList of ArrayLists or an ArrayList of Hashtables? Thanks in advance KC
11
by: paradox | last post by:
Basically I have an ArrayList of strings; I need a fast way of searching through and comparing the elements of the ArrayList and the return an ArrayList of items that have 3 Duplicates. For...
3
by: Fred | last post by:
I'm trying to build a hashtable and a arraylist as object value I'm not able to retrieve stored object from the hashtable. Hashtable mp = new Hashtable(); // THE HASHTABLE ArrayList...
3
by: Sam | last post by:
Hi Everyone, I have a stucture below stored in an arraylist and I want to check user's input (point x,y) to make sure there is no duplicate point x,y entered (string label can be duplicated). Is...
10
by: chrisben | last post by:
Hi, Here is the scenario. I have a list of IDs and there are multiple threads trying to add/remove/read from this list. I can do in C# 1. create Hashtable hList = Hashtable.Synchronized(new...
2
by: Bruce | last post by:
Hi I am having a problem understanding the exact advantages of using an ArrayList over a Hashtable in any situation. In most areas of an application I am working on, lookup needs to be fast. If I...
7
by: Kamran Shafi | last post by:
Hi, I am creating an arraylist (say masterArrayList) of hashtables, where each hashtable (say table) is of the format key=string, value = arraylist of strings (say existing_strings). In a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.