Disabling validation?

2 posts, 0 answers
  1. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 25 Oct 2012 Link to this post

    I have a RadDataForm that is bound to a heterogeneous collection. I'm using a DataTemplateSelector to select an appropriate DataTemplate for each Item, as it becomes current.

    There is, of course, a different template for each type of item, but they all share some bothersome properties:
    • They all include a large number of controls
    • They all include a large number of validation rules
    • They all include many validation rules that operate between controls or on groups of controls.

    As an example, each template has a three or more GroupBoxes, and validation rules that require that at least one checkbox in group A and at least one checbox in group B be selected, unless a checkbox in group C is selected, in which case all of the fields in groups A and B must be cleared.

    The resulting rules were complex to construct, but they work correctly, now, when the form is being edited. The problem is when the form is being viewed.

    When the form is open in view-only mode, and I navigate from one item to the next, using the prev/next buttons, it's taking more than a second for the new item to be displayed. And that's entirely unacceptable.  I've been digging into it, trying to identify where the time is being spent, and from what I can see the largest part is in the validation code. All of these fields are validating against each other, this checkbox is checking to make sure that that field is not empty, this groupbox is checking to see that it has at least one checkbox checked, and that the other checkbox does not, etc.

    And what's really aggravating is that none of this is necessary. Even if the data in the database were somehow incorrect, when it is loaded into the form in view-only mode, I'd not want to display validation errors.  What is in the database is what is in the database, regardless of what it is. Validation should be occurring only in edit mode.

    So, is there a way to turn off the validation checks? To load the data without running the validation checks?
  2. Ivan Ivanov
    Ivan Ivanov avatar
    1114 posts

    Posted 30 Oct 2012 Link to this post


    Currently it is not possible to surpass the internal validation logic. However, there are certain scenarios when validation in read-only mode would be useful. In order, to meet the requirements of both cases, we decided to implement a mechanism, similar to RadGridView's ValidatesOnDataErrors property. We will do our best to include this in the incoming service pack.

    All the best,
    Ivan Ivanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
Back to Top