I'm just sitting in front of my first real asp.net c# project and I dont know how to validate that the user must checked 4 checkboxes to get to the next step on my site.
ASP.Net
<div class="panel-body">
<p>Select 4 Items from the List</p>
<label class="checkbox">
<asp:CustomValidator ID="SelectValidator" runat="server"
ErrorMessage="Please select FOUR (4) Items!"
OnServerValidate="SelectValidator_ServerValidate"></asp:CustomValidator>
<asp:CheckBox ID="CheckBox1" Text="" runat="server" /><br>
<asp:CheckBox ID="CheckBox2" Text="" runat="server" /><br>
<asp:CheckBox ID="CheckBox3" Text="" runat="server" /><br>
<asp:CheckBox ID="CheckBox4" Text="" runat="server" /><br>
<asp:CheckBox ID="CheckBox5" Text=" " runat="server" /><br>
<asp:CheckBox ID="CheckBox6" Text="" runat="server" /><br>
<asp:CheckBox ID="CheckBox7" Text="" runat="server" /><br>
<asp:CheckBox ID="CheckBox8" Text="" runat="server" /><br>
<asp:CheckBox ID="CheckBox9" Text="" runat="server" /><br>
</label>
</div>
Code Behind
protected void SelectValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = CheckBox1.Checked;
}
That is what I have and found in the internet right now for Server and Clientsite.
countto count the total checkboxes checked! I am not able to understand web-forms, but still I can give you a guess! :)