|-|x 126 Junior Poster in Training

Hi All

I'm looking for ideas or suggestions about how to implement this feature.

The concept is I have 2 dropdown select boxes, with data that is not directly related (in the sense that there is no identifiers or foreign keys or anything within the data itself) but that have a logical relationship (although some data may not correlate to anything).
The dropdowns are populated from a database via ASP.NET, and I need to be able to select a value in dd2 based on the user selection of dd1.
I am hoping to do this in javascript so as to avoid the need to postback whenever the selection changes.

Example data set;

 dd1   dd2  |  relationship
 A     W    |  A -> X
 B     X    |  B -> Z
 C     Y    |  C -> Y
 D     Z    |  E -> W
 E          |  F -> Z
 F          |  

I am thinking at this point that I will have to dynamically generate the javascript with a large array defining the relationships and check through it upon dd1 selection.

My question is, is there a more efficient way of doing this?
Can I set javascript events on the list items themselves, and would that be better?

How would you approach finding a solution to this problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.