Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DropDownList

Status
Not open for further replies.

seiamerica

Technical User
Dec 27, 2005
13
US
I have 10 dropdownlist box with 10 options in each list. I should not be able to select the same option for tow boxes. ex if I select 1 in ddl1 I should not be able to select 1 in any of the remaining dropdownlist boxes. I wrote a funcitn to do this but very lenthy. So I want any suggstions if this can be achieved simply with compare validator in asp.net. Any help is greately appreciated.
 
Using CompareValidator would mean that you must insert in that page a bunch of validators.

Here is another ideea:

Using this implementation of the Hashtable, writen in JS ( ) you could insert the text boxes like that:


1. Verify if the hashtable contains the key represented by the option selected in the current textbox. If yes, issue an error message telling the user that another textbox has that option already selected and eventually, based on that key, extract the textbox from the hashtable and set focus on it so that the user sees the mistake.
2. If the hashtable does not contain that key, add the the textbox selected option as the key and the textbox itself as the object.
3. Repeat steps 1-2 until the hashtable contains all textboxes. When done, it means that all the options selected in your text boxes are different.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top