4
Reply

CustomValidator of ClientValidationFunction was not firing

manjula d

manjula d

Aug 6 2013 6:58 AM
8.5k
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>





Answers (4)