Issues with DropDownList selecting items

Fork501
11-05-2006, 07:48 PM
Hey, all!

I have an ASP DropDownList, which I want to populate with a certain field in a database. Right now, it does that. But because I'm telling the page to delete a record based on the selected field, I must tell it to clear the DropDownList every time the page is loaded.


cboUsers.Items.Clear()


Now, every time I try to select the item, which is selected, it only shows whatever index(0) has.


response.Write(cboUsers.SelectedItem.Text)


If the first user's name in the list is 999999, no matter what user name I select, 999999 is what it considers selected.

Any ideas?

Thanks!

(ASP.NET)

~Derek

wayneph
11-06-2006, 07:53 AM
If you Clear the Items collection you lose your selection. Period.

1. Either look up the value before you clear the list, or
2. Don't clear the list. Just go remove the individual items you need to.

If you can tell us more about your overall goal maybe we can give you another suggestion.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum