-
Checkbox Disabled
Hi,
My page was created with a multiview which has 3 views.
Now on one of the view I have a checkbox called chkpeer. So, when this checkbox is checked it triggers a submit button to be set to visible and active with the code below;
Code:
Protected Sub chkpeer_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkpeer.CheckedChanged
If chkpeer.Checked = True Then
chkpeer.Enabled = True
btnSub.Visible = True
Else
btnSub.Visible = False
End If
End Sub
The asp code is
Code:
<asp:CheckBox ID="chkpeer" runat="server" CssClass="checkbox" AutoPostBack = "True" />
Now the problem is, when I check chkpeer - btnsub becomes visible set to TRUE. Then when I move to the next View without clicking the submit button then return to the view with chkpeer,
1) chkpeer is still ticked but disabled
2) btnsub visible is SET to FALSE.
I would prefer one of the following
Either have the chkpeer checked - enabled and btnSub still Visible (Ideally)
Or Chkpeer unchecked and enabled so that when I check it again it activates the btnSub ..
Please help!! Thank you
-
Re: Checkbox Disabled
-
Re: Checkbox Disabled
Thread moved to the 'ASP.Net' forum, which is where questions about .Net web pages belong
-
Re: Checkbox Disabled
Hello dr223,
The problem here is that you are doing multiple postbacks to the server, which is causing the state of the button to change.
If the only thing that you are doing when the CheckBox gets selected, is to enable a button, you might want to look into doing this on the client side, and stop controlling the state from the server.
Gary