Results 1 to 2 of 2

Thread: Setting the Drop-down listbox Default value

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Posts
    13

    Setting the Drop-down listbox Default value

    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)...

  2. #2
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774
    ddl.Items.FindByText("TextToFind").Selected = true;


    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width