CustomValidator of ClientValidationFunction was not firing
CustomValidator of ClientValidationFunction was not firing
my code:
function ValidateAddress(source, args) {
debugger;
var chkaddress = document.getElementById("<%=chkbox.ClientID %>");
var address1 = document.getElementById("#<%=txtAddressLine1.ClientID %>").val();
if (chkaddress.checked) {
debugger;
if (address1 == "") {
args.IsValid = false;
}
else {
args.IsValid = true;
}
}
}
<asp:CustomValidator ID="cvaddress" runat="server" ValidateEmptyText="true" ControlToValidate="txtAddressLine1" ClientValidationFunction="ValidateAddress" ErrorMessage="Please Enter Address" ForeColor="Red" Display="Dynamic" ></asp:CustomValidator>