SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DropDownList Control Issues

    I wonder why does the dropdownlist always set to index 0. I have a function that dynamically fill the dropdownlist control, now every time that I select an item (example index 5) in the dropdownlist control it always goes to index 0. Can anyone help me. Thanks in advance.

  2. #2
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Clogland
    Posts
    322
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you repopulating the DropDownList on postback? (and is the DropDownList set to AutoPostback?)

  3. #3
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    396
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The said function is just invoke in Page Load. Therefore, I am not repopulating it. Every time I click on the Button it always set to index 0. By the way the DropDownList AutoPostBack property is not set True.

  4. #4
    SitePoint Wizard webcosmo's Avatar
    Join Date
    Oct 2007
    Location
    Boston, MA
    Posts
    1,480
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This usually happens when you have EnableViewState set to false for page and such. Is thats the case you have to explicitly check the previously selected value of the DDL and set that selected on every page load.
    Is that the case?

  5. #5
    SitePoint Addict
    Join Date
    Feb 2005
    Location
    Clogland
    Posts
    322
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The said function is just invoke in Page Load
    But are you checking for isPostback before populating the List from Page_Load? (You do realise that Page_Load is invoked with every page request, including postbacks? )


Bookmarks

Posting Permissions

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