When I run code the below, the If statement never resolves to ‘True’. It always shows ‘Assm’ as the SelectedItem, even if I check all the checkboxes.
So how do I allow ‘Assm’ to be checked by default AND have the code-behind see that the other checkboxes are checked?
<asp:CheckBoxList ID="qualityChecks" runat="server" RepeatDirection="Horizontal" TabIndex="8">
<asp:ListItem Text="Assm" Selected="True"></asp:ListItem>
<asp:ListItem Text="Qual"></asp:ListItem>
<asp:ListItem Text="PMgr"></asp:ListItem>
<asp:ListItem Text="Plant"></asp:ListItem>
</asp:CheckBoxList>
If qualityChecks.SelectedItem.Text = "Qual" Then
'Some Code
End If
SelectedItem of a CheckBoxList works that way.
What you want to do is iterate through the ListItems and see if they are Checked.