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>
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.";
}
Aucun commentaire:
Enregistrer un commentaire