I am updating a page which has a table with four checkboxes that receives data from a db. The results are sent to a database, but
only two of the four checkbox values are stored into two fields in the db.
Critical
The user can not select more than two of the four checkboxes at any given time; the remaing 2 checkboxes must always be
disabled.
Currently
When the page loads the appropriate 2 of the 4 checkboxes are checked and the remaining 2 are unchecked and enabled.
Goal:
(1) When the page loads how do I disabled the 2 unchecked checkboxes.
(2) When the user unchecks 1 of the 2 currently checked checkboxes--enable the other 2 checkboxes which were previously
disabled.
(3) Only 2 of the 4 checkboxes are checked at any given time and the remaining 2 must be disabled.
My code snipet------>When the page loads, my aspx.
vb is:
If DSPageData.Tables("ViewSelected").Rows(0).Item("Ty peCode1") = "Q" Or
DSPageData.Tables("ViewSelected").Rows(0).Item("Ty peCode2") = "Q" Then
chkQuality.Checked = True
End If
If DSPageData.Tables("ViewSelected").Rows(0).Item("Ty peCode1") = "F" Or
DSPageData.Tables("ViewSelected").Rows(0).Item("Ty peCode2") = "F" Then
chkFinancial.Checked = True
End If
If DSPageData.Tables("ViewSelected").Rows(0).Item("Ty peCode1") = "C" Or
DSPageData.Tables("ViewSelected").Rows(0).Item("Ty peCode2") = "C" Then
chkCustomer.Checked = True
End If
If DSPageData.Tables("ViewSelected").Rows(0).Item("Ty peCode1") = "E" Or
DSPageData.Tables("ViewSelected").Rows(0).Item("Ty peCode2") = "E" Then
chkEmployee.Checked = True
End If
My .aspx looks like:
<htm>
<head><title>Checkbox and More</title></Head>
<body>
<form>
<table>
<asp:checkbox id="chkQuality" runat="server" Text="Quality" AutoPostBack="True"></asp:checkbox>
<asp:checkbox id="chkFinancial" runat="server" Text="Financial" AutoPostBack="True"></asp:checkbox>
<asp:checkbox id="chkCustomer" runat="server" Text="Customer Service" AutoPostBack="True"></asp:checkbox>
<asp:checkbox id="chkEmployee" runat="server" Text="Employee" AutoPostBack="True"></asp:checkbox>
<asp:button id="btnUpdate" runat="server" Font-Names="Arial" Text="Save"></asp:button>
</table>
</form>
</body>
</html>