Custom validation method doesn’t fired if it used with textbox control and its value is empty


​To avoid using of the ValidatorEnable method to disable required field validator at some cases on textbox control I decided to use custom validator as a required field just like the following:

<asp:CustomValidator ID="_examDateCustomValidator" runat="server" Text="*"
 ClientValidationFunction="CustomValidateDDL" ControlToValidate="_textbox">

And here is the javascript validation method

function CustomValidateDDL(sender, args)
  if (args.Value == "")
      args.IsValid = false;
       args.IsValid = true;

unfortunatily I found that this method is working well if I compare the value with any other value except empty text

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s