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?