Hi folks, can not get my checkbox validation to validate before page is redirected, code below
<asp:CheckBox ID="chboxTerms" runat="server" style="text-decoration: underline" Text=" I have read and accept the terms and conditions." />
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
Code behind
public partial class Pages_Invoice : System.Web.UI.Page
{
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
//determine if CheckBox1 is checked or not, if it is validate it, else don't
if (chboxTerms.Checked)
args.IsValid = true;
else
args.IsValid = false;
}
p ...
Go to the complete details ...