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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. ComoboBox selection not changing

ComoboBox selection not changing

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
2 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.
  • G Offline
    G Offline
    Gymnast
    wrote on last edited by
    #1

    I have a simple app that has several ComboBoxes. I should be able to change the ComboBox1 selection even after I have changed ComboBox3 (or ComboBox4, should the user change his/her mind). But my ComboBox1, even after changing, when tabbed out of, reverts to the earlier selection. As a start, cboEvents.SelectedIndex = 3. I then move to cboTime and select a certain value there (in cboTime). I then return to cboEvents and change the SelectedIndex to 9. But when I tab out of cboEvents, it reverts to SelectedIndex = 3 (the original selection). Can someone show me how to discard the old selection and save the new selection? PS. I have to mention that cboTime is dependant on cboEvent selection (the code that populates cboTime is based on the SelectedIndex of cboEvents). Thanks!

    M 1 Reply Last reply
    0
    • G Gymnast

      I have a simple app that has several ComboBoxes. I should be able to change the ComboBox1 selection even after I have changed ComboBox3 (or ComboBox4, should the user change his/her mind). But my ComboBox1, even after changing, when tabbed out of, reverts to the earlier selection. As a start, cboEvents.SelectedIndex = 3. I then move to cboTime and select a certain value there (in cboTime). I then return to cboEvents and change the SelectedIndex to 9. But when I tab out of cboEvents, it reverts to SelectedIndex = 3 (the original selection). Can someone show me how to discard the old selection and save the new selection? PS. I have to mention that cboTime is dependant on cboEvent selection (the code that populates cboTime is based on the SelectedIndex of cboEvents). Thanks!

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      When you change the selection of combo box, the page gets a post back and your combo box is again assigned the old value it had earlier. You need to decide, weather you want to use the AutoPostBack property of the combobox or check the IsPostPack property of the page while assigning the value to combobox.:rose:

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      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