This is a migrated thread and some comments may be shown as answers.

How to disable clientside validation if control is readonly?

1 Answer 299 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
mqsash
Top achievements
Rank 1
mqsash asked on 01 May 2013, 06:17 PM
Hi

On most of our system's pages we have input controls with required field validators for a few of the controls and the validators work just fine.

Now, under certain conditions, for example based on user permissions, some of these input controls can be rendered as readonly.
In such situations we would like the validator (at least the clientside validator) to not fire if the control is empty but readonly.

Whats the best way to achieve the above in a centralized code? 
FYI - In the past we have used other third party controls in which the validator automatically skipped the client side validation if the control was readonly or disabled. Does telerik have a way to achieve the same behavior?

Thanks
mqs

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 06 May 2013, 10:22 AM
Hello,

You can use CustomValidator and to check if control is ReadOnly. Or you can add the validators only if the controls are not ReadOnly.
I am not sure about the other controls. Maybe they are overriding parts of the JavaScripts of the Validators to achieve this. However we are not supporting such functionality to validate the TextBoxes only if they are not read only.
There is a thread in Microsoft's site about the issue: http://support.microsoft.com/kb/917733 and it looks more like a problem, than a desired function of the Validator controls.

All the best,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
General Discussions
Asked by
mqsash
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or