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. CheckedListBox and SqlDataSource not surviving postback - Long Story [modified]

CheckedListBox and SqlDataSource not surviving postback - Long Story [modified]

Scheduled Pinned Locked Moved ASP.NET
databasewinformsdesignhelpquestion
1 Posts 1 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.
  • M Offline
    M Offline
    MaxRelaxman
    wrote on last edited by
    #1

    Okay, here's my situation... I have three CheckBoxList. #1 is a list of four states. When a state is checked off, a sql query to retrieve a list of cities is generated in the control's SelectedIndexChanged method that is assigned to a SqlDataSource control's SelectCommand property. So far so good. However, control #2 is supposed to generate a query to fill a third CheckBoxList of stores in each city based on the cities the user checks. What happens is control #1's SelectedIndexChanged method fires on the post back when an item is checked in control #2. I tried handling this by checking the query generated by control #1 against the query in the SqlDataSource bound to control #2, however the datasource resets back to its original query created at design time. The EnableViewState property is set to true so I can't figure out why this is happening. I was also thinking that I could check the "object sender" parameter passed to the SelectedIndexChanged method of control #1 but that seems to indicate that control #1 is what is causing the post back rather than control #2. Another weird (to my Windows Forms based mind) is that when an item is selected in control #1, control #2's SelectedIndexChanged method isn't fired. Both control #1 and control #2 are set to AutoPostBack and are identical except for formatting stuff and the fact that they are bound to different SqlDataSources. control #3 doesn't post back, however just for the heck of it I set AutoPostBack to true. When an item is selected in control #3, control #1's SelectedIndexChanged method fires but again control #2's doesn't. Again, this is really weird because for the most part the controls are identical. Help, my brain is melting! :v) EDIT: I don't know if it makes a difference but control #1's values are hard coded so it isn't bound to a SqlDataSource -- modified at 12:29 Wednesday 8th August, 2007

    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