Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. DropdownList problem

DropdownList problem

Scheduled Pinned Locked Moved ASP.NET
questionhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wbeetge
    wrote on last edited by
    #1

    I have a DropDownlist on my ASPX form. I need to populate another DropDownList when I make a selection from the first one. As soon as the code behind triggers on the SelectedIndexChanged event, the selected item resets to Item(0). Trying to use the value of the selected item in the code then always uses the first listitem, and not the last selected item. How do I stop this from happening when code-behind is executed ?

    S 1 Reply Last reply
    0
    • W wbeetge

      I have a DropDownlist on my ASPX form. I need to populate another DropDownList when I make a selection from the first one. As soon as the code behind triggers on the SelectedIndexChanged event, the selected item resets to Item(0). Trying to use the value of the selected item in the code then always uses the first listitem, and not the last selected item. How do I stop this from happening when code-behind is executed ?

      S Offline
      S Offline
      Spanky3
      wrote on last edited by
      #2

      in the page_load do: if(!IsPostBack) { //Load List drop down list } This means the list will only load at page load up :) and postbacks wont cause the change! Atul

      W 1 Reply Last reply
      0
      • S Spanky3

        in the page_load do: if(!IsPostBack) { //Load List drop down list } This means the list will only load at page load up :) and postbacks wont cause the change! Atul

        W Offline
        W Offline
        wbeetge
        wrote on last edited by
        #3

        Thank you spanky3 Beautiful.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups