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!

Remove already selected values from a dropdownlist 1

Status
Not open for further replies.

dodge20

MIS
Jan 15, 2003
1,048
US
I have a page with 10 dropdownlists each populated with the same data from a database. When a value is selected from the first dropdownlist, I don't want to see that value as an option in the remaining dropdownlists. Can you point me in the right direction?

Thanks

Dodge20
 
That sounds like you would have to do that using javascript. You can post in that forum.
 
Darn I was hoping something like this would work.

Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
DropDownList2.Items.Remove(DropDownList1.SelectedItem)
End Sub


Dodge20
 
Well, that could be a possibility, but I am just not sure I would approach the problem this way.
What happens if the person selects the item, you then remove it from all other ddls. Now they select a different item from the same ddl, now you have to rebind all the ddls and remove the appropriate one. This kind of sounds like a nightmare.

I would rethink what you are trying to do. Maybe if you explain what it is you need to do, we can come up with a better solution.
 
Thanks jbenson001 I think you are right, javascript probably is the way to go. I am brand new to asp.net and was just curious if it was possible.

Dodge20
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top