Conditionally disabling/enabling Validator controls in ASP.net

I had a situation where depending on a checkbox, I needed to enable/disable a RequiredFieldValidator control using Javascript. Found out that this is really simple to do. All you have to do is write the following line in Javascript

ValidatorEnable(<%=reqLogin.ClientID %>,true); //Where reqLogin is the RequiredFieldValidator which I want to conditionally enable/disable.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s