manjula d

manjula d

  • NA
  • 172
  • 139.7k

CustomValidator of ClientValidationFunction was not firing

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