Selected ListItem in DropDownList does not appear selected

Discussion in 'ASP .Net' started by Nathan Sokalski, Oct 5, 2008.

  1. I have a DropDownList in which I set the SelectedIndex property in my code.
    However, when I run a debug it does not appear selected (actually, none of
    the ListItems are even visible in the DropDownList until I click the arrow
    to select one). However, when I do a view source it has the following:

    <select name="ctl00$cphContent$dtpBothAMPM$ddlAMPM"
    id="ctl00_cphContent_dtpBothAMPM_ddlAMPM">
    <option value="AM">AM</option>
    <option selected="selected" value="PM">PM</option>
    </select>

    As you can see, not only are the option tags there, but one of them (the one
    I set to be selected in my codebehind) has the selected="selected"
    attribute. Why is it not appearing selected like all the other DropDownLists
    I set the SelectedIndex for? Thanks.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
     
    Nathan Sokalski, Oct 5, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mad Scientist Jr
    Replies:
    2
    Views:
    500
    Mad Scientist Jr
    Jun 29, 2004
  2. John Smith
    Replies:
    0
    Views:
    5,030
    John Smith
    Jun 6, 2006
  3. John Smith
    Replies:
    0
    Views:
    1,358
    John Smith
    Jun 7, 2006
  4. Jim in Arizona
    Replies:
    7
    Views:
    982
    Badass Scotsman
    Nov 22, 2006
  5. Nathan Sokalski

    Selected ListItem in DropDownList does not appear selected

    Nathan Sokalski, Oct 5, 2008, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    318
    Nathan Sokalski
    Oct 5, 2008
Loading...

Share This Page