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. CheckedChanged Event not firing

CheckedChanged Event not firing

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestion
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.
  • K Offline
    K Offline
    krisp
    wrote on last edited by
    #1

    Hi there, In ASP.Net, my checkbox is not firing its checkedchanged event when its the first postback of the page, and the checkbox was initially checked. If the checkbox was unchecked initially, it works everytime, but if it wasn't checked initially then it does not work the first time you uncheck it, then after you uncheck it and then when you check it again, it fires. It always posts back everytime, and __EVENTTARGET is always the checkbox's name. InitializeControls adds the event handler everytime, for both page_load and checkedchanged, even on the first postback when you uncheck the checkbox, it adds the handler but it does not get called. Page_Load always gets called. Anyone have any, off the top of their heads, ideas of what would cause it to ignore the checkedchanged event? Thanks for any suggestions of where I could start.

    J 1 Reply Last reply
    0
    • K krisp

      Hi there, In ASP.Net, my checkbox is not firing its checkedchanged event when its the first postback of the page, and the checkbox was initially checked. If the checkbox was unchecked initially, it works everytime, but if it wasn't checked initially then it does not work the first time you uncheck it, then after you uncheck it and then when you check it again, it fires. It always posts back everytime, and __EVENTTARGET is always the checkbox's name. InitializeControls adds the event handler everytime, for both page_load and checkedchanged, even on the first postback when you uncheck the checkbox, it adds the handler but it does not get called. Page_Load always gets called. Anyone have any, off the top of their heads, ideas of what would cause it to ignore the checkedchanged event? Thanks for any suggestions of where I could start.

      J Offline
      J Offline
      John Kuhn
      wrote on last edited by
      #2

      I tried to see if I could reproduce your problem -- to no avail. I created the following code for an ASP.NET Web Form using VB.NET:

      Private Sub Page\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          'Put user code to initialize the page here
          TextBox2.Text = "Page Loaded"
      End Sub
      
      Private Sub CheckBox1\_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
          TextBox1.Text = "CheckBox1 Changed"
      End Sub
      

      No matter what properties I set on CheckBox1, when I click the "submit" button on the page, if I have changed the value of CheckBox1, the value of TextBox1 changes. Perhaps you somehow broke the binding of the CheckChanged event to the CheckBox1_CheckChanged method?

      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