PDA

Click to See Complete Forum and Search --> : Setting the Drop-down listbox Default value


wheels
Aug 1st, 2002, 10:38 AM
ok, this seems like it should be an easy enough task...

I want to be able to set which item is selected in a Drop-down listbox based upon a database query.... This is on an .aspx.vb page.


DDL_Choice1.SelectedItem.Text = "whatever value"

- this doesn't work because it over-writes the first value in the list with the value specified.


DDL_Choice1.Items("whatever value").Selected = True

-this doesn't work either because "whatever value" MUST be the index of the item you want selected, which I don't know because the items in the dropdown list are dymanically created as well.



there has to be a simple way to specify which VALUE is selected (in the VB code-behind-page)...

Patoooey
Aug 5th, 2002, 01:55 AM
ddl.Items.FindByText("TextToFind").Selected = true;


John