Lose checkbox onclick event after updateitem(true) in a formview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rljsjones
    New Member
    • Mar 2010
    • 2

    #1

    Lose checkbox onclick event after updateitem(true) in a formview

    Hi,

    I have a checkbox (AllofNevada) that should enable/disable a checkboxlist (of counties in Nevada). The javascript code I have works. I placed the code:
    Code:
    Protected Sub frmTDMaintenance_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles frmTDMaintenance.Load
            CType(frmTDMaintenance.FindControl("AllofNevada"), CheckBox).Attributes.Add("onclick", "fnAllofNevada();")
        End Sub
    This is fine in the beginning but once the user selects 'save' and the code:
    frmTDMaintenanc e.UpdateItem(Tr ue) runs the onclick event is lost. You can see it in the rendered code originally and then it is gone after the update item. I can comment out the frmTDMaintenanc e.UpdateItem(Tr ue) and the onclick event still runs? Any ideas why? A work around? I tried adding the attributes.add code after the updateitem code but that didn't work either.

    Thanks
    Last edited by Frinavale; Mar 31 '10, 01:49 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Which onclick event are you referring to?

    Are you talking about the "save" button's onclick event??

    One important thing to know is that when you disable things via JavaScript they are not even submitted to the server...


    -Frinny

    Comment

    • rljsjones
      New Member
      • Mar 2010
      • 2

      #3
      Still having the problem

      Frinny:
      The 'onclick' event that is getting lost is for the checkbox 'allofnevada'. When the checkbox is clicked it should either enable or disable a checkbox list of counties. So, if the checkbox is 'checked' the individual counties checkbox list is disabled and vice versa. This part is working correctly. But, once the form is saved with: UpdateItem(True ) then the 'onclick' event no longer fires when the 'allofneveda' checkbox is checked.
      Thanks for your help

      Comment

      Working...