I need to show an asterix to the correspondent checkbox when the user try to send the form without check the checkbox...
I found something like this but is not working, like the normal others <asp:RequiredFieldValidator
fields:
<asp:CustomValidator ID="CheckBoxValidator" runat="server" onservervalidate="CheckBoxRequired_ServerValidate" Display="Dynamic" CssClass="error-text" ErrorMessage='*' ValidationGroup="save"> * </asp:CustomValidator>
asp:CheckBox ID="YourCheckBox" runat="server" text=" I accept your terms and conditions bla bla bla" />
And in the code behind I have:
protected void CheckBoxRequired_ServerValidate(object sender, ServerValidateEventArgs e)
{
e.IsValid = YourCheckBox.Checked;
labelMessage.Text = "Your reservation has been processed.";
}