Odd Checkbox action

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have this page. It has 3 textboxes and 4 checkboxes, and 20 or so hidden
lables.
When one of the checkboxes is checked, it will display data by making some
labels visible, and others invisible. Everything works fine, except when the
page is firt loaded, and one of the boxes it checked, it postsback and the
form gets cleared. Even the checkbox that was checked is cleared. After that,
everything works fine. It's just that first click. Anybody have any ideas why
that might be?

Thanks

Casey
 
Here's the code for the checkboxes. There is nothing in my Page_Load, and the
panels really only contain text. Any ideas?

Private Sub chkVideo_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles chkVideo.CheckedChanged

If chkVideo.Checked = True Then
chkLevels.Enabled = False
pnlCustomerInfo.Visible = True
pnlLocation.Visible = True
pnlSection1.Visible = True
pnlSection3.Visible = True
pnlComments.Visible = True
Else
pnlSection1.Visible = False
If chkModem.Checked = False Then
pnlCustomerInfo.Visible = False
pnlSection3.Visible = False
End If
If chkModem.Checked = False And chkPlant.Checked = False Then
chkLevels.Enabled = True
pnlLocation.Visible = False
pnlComments.Visible = False
End If
End If
End Sub

Private Sub chkModem_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles chkModem.CheckedChanged
If chkModem.Checked = True Then
chkLevels.Enabled = False
pnlCustomerInfo.Visible = True
pnlLocation.Visible = True
pnlSection3.Visible = True
pnlSection4.Visible = True
pnlComments.Visible = True
reqLevels.Enabled = True
chkSlowSpeeds.Visible = True
Else
pnlSection4.Visible = False
reqLevels.Enabled = False
chkSlowSpeeds.Visible = False
If chkVideo.Checked = False Then
pnlCustomerInfo.Visible = False
pnlSection3.Visible = False
End If
If chkVideo.Checked = False And chkPlant.Checked = False Then
chkLevels.Enabled = True
pnlLocation.Visible = False
pnlComments.Visible = False
End If
End If
End Sub

Private Sub chkPlant_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles chkPlant.CheckedChanged
If chkPlant.Checked = True Then
chkLevels.Enabled = False
pnlLocation.Visible = True
pnlSection2.Visible = True
pnlComments.Visible = True
pnlCustomerInfo.Visible = True ' show this panel, but dim some
of the items.
chkAffectsCust.Enabled = False ' disbale this option...
chkHouseAmp.Enabled = False 'disbale this option...
chkIssueTap.Enabled = False 'disbale this option...
chkDrop.Enabled = False 'disable this option...
radioConstant.Enabled = False 'disable this option...
radioConstant.Checked = False 'uncheck this...
radioInter.Enabled = False 'disable this option...
Else
pnlSection2.Visible = False
chkAffectsCust.Enabled = True ' reenable this option...
chkHouseAmp.Enabled = True 'reenable this option...
chkIssueTap.Enabled = True 'reenable this option...
chkDrop.Enabled = True 'reenable this option...
radioConstant.Enabled = True 'reenable this option...
radioConstant.Checked = True 'recheck this...
radioInter.Enabled = False 'reenable this option...
If chkVideo.Checked = False And chkModem.Checked = False Then
chkLevels.Enabled = True
pnlLocation.Visible = False
pnlComments.Visible = False
pnlCustomerInfo.Visible = False
End If
End If
End Sub

Private Sub chkLevels_CheckedChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles chkLevels.CheckedChanged
If chkLevels.Checked = True Then
chkPlant.Enabled = False
chkModem.Enabled = False
chkVideo.Enabled = False
pnlLocation.Visible = True
pnlSection3.Visible = True
pnlComments.Visible = True
Else
chkPlant.Enabled = True
chkModem.Enabled = True
chkVideo.Enabled = True
pnlLocation.Visible = False
pnlSection3.Visible = False
pnlComments.Visible = False
End If
End Sub
 
Hi Casey,

Could you also post the .aspx content? Otherwise, I have to put it together
from the names in the codebehind.
 
Back
Top