How to disable clientside validation if control is readonly?

2 posts, 0 answers
  1. mqsash
    mqsash avatar
    31 posts
    Member since:
    May 2012

    Posted 01 May 2013 Link to this post

    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
  2. Vasil
    Admin
    Vasil avatar
    1642 posts

    Posted 06 May 2013 Link to this post

    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.
Back to Top