I have a list of checkbox that i need to validate
<asp:CheckBoxList runat="server" ID="listcontrat" >
<asp:ListItem Value="cdd" >CDD</asp:ListItem>
<asp:ListItem Value="cdi" >CDI</asp:ListItem>
<asp:ListItem Value="interim" >Intérim</asp:ListItem>
<asp:ListItem Value="stage" >Stage/Apprentissage</asp:ListItem>
</asp:CheckBoxList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Champ obligatoire" Text="Champ obligatoire" ForeColor="Red" ControlToValidate="listcontrat"></asp:RequiredFieldValidator>
When i tried this code above i got this error:
Control 'listcontrat' referenced by the ControlToValidate property of 'RequiredFieldValidator2' can not be validated.
So:
- What is the reason of this error?
- How can i fix my snippet?