Theomax
Theomax

Reputation: 6792

How to set ValidatorEnable() javascript attribute for a validator?

I have a validator which I can enable or disable using the following javascript:

<script type="text/javascript">
    ValidatorEnable($("#<%=validator2.ClientID%>")[0], true);
</script>

How can I set this attribute of the validator using C# in the code behind?

I have tried using the following C# but it didn't work:

validator2.Enabled = true;

What code do I need to use in the code behind to set ValidatorEnable = true for the Validator2 control? I have researched this on the net but couldn't find how to do this.

Upvotes: 2

Views: 7323

Answers (2)

Pankaj
Pankaj

Reputation: 10105

You can change the Validation Group of the validator in code behind

Upvotes: 1

Fr&#233;d&#233;ric Hamidi
Fr&#233;d&#233;ric Hamidi

Reputation: 262979

The property is named Enabled, not Enable:

validator2.Enabled = true;

Upvotes: 4

Related Questions