ValidatorEnable

A nifty way to enable and disable all .Net validator controls is the use the ValidatorEnable() method. There are two parameters that constitute the method signature:

parm 1: instance of the validator control to be enabled/disabled.

parm 2: enabled indicator (true = enabled, false = disabled).

 

If I had the following validation control:

<asp:RequiredFieldValidator ID="vldCustName" runat="server"
    ControlToValidate="txtCustomerName"
    ErrorMessage="Customer Name Required">

</asp:RequiredFieldValidator>

 

I can disable the control like so:

ValidatorEnable($get('<%= txtCustomerName.ClientID %>'), false);

 

Please note that this is using the ASP.Net Ajax Framework to access the server control, hence the "$get('<%= txtCustomerName.ClientID %>')" line of code.

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.