Current filter:
                                You should refresh the page.
                                  • We have a tab control with a small number of child controls. During validation we appear to be getting invalid results since the user may not have shown both tabs. As far as I can determine, the XtraTabControl is lazy loading the child controls. While this is extremely helpful for a situation with lots of child controls it is making the validation difficult for this particular situation. Is there a way to turn off lazy loading on the XtraTabControl?
                                    Mike

                                • Nick (DevExpress Support) 11.19.2009

                                  Hi Mike,
                                  I suppose that your controls on tab pages are bound to data. In this case, you may be faced with the following specifics of Windows Forms binding: data bound controls are not updated while they remain invisible. Your validation code should retrieve values directly from data objects rather than from controls.
                                  If my assumption is wrong, please send your test project and provide step-by-step instructions on how to recreate the problem. I'll do my best to find a solution.
                                  Thanks,
                                  Nick
                                  --------------------
                                  Check if Search Engine is able to answer questions faster than I do!

                                • Michael Reith 11.20.2009

                                  Hi Nick,
                                  Your assumption appears to be correct and explains why the validation fails. However, I am using the DXValidationProvider. It seems to me that the DXValidationProvider should get it's value from the underlying data object (unless the control has an active editor). Without that, the DXValidationProvider has greatly reduced functionality. For instance, a user could customize a DataLayoutControl to have tabs and then validation would fail if there were incorrect data on a tab that was never visible.
                                  Is there a reason that the DXValidationProvider does not obtain it's value from the underlying data object? Attached is a project which demonstrates this issue.
                                  Thanks,
                                  Mike

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Mike,
                                Thank you for the sample project. The DXErrorProvider knows nothing about the editor's data source. Moreover, it's unclear at the DXErrorProvider level whether the editor is bound to the data. Currently, the DXErrorProvider only checks the EditValue of the editor:

                                [C#]
                                if(!rule.Validate(ctrl, ctrl.EditValue)) { .. }

                                If we check at this point whether editor is bound, and, if so, obtain value from the data source using property descriptors (it's possible only if the data source implements the ITypedList interface), the code of the DXErrorProvider will be significantly complicated and the performance of the validation will also be impaired. That is why we doesn't want to perform this change.
                                In most situations, it's better to validate controls per page, so that users can see all data, which is currently validated and correct invalid values. Otherwise, they should open each page before the invalid value is found.
                                If this scenario doesn't meets your requirements, and you need to validate the entire business object at once, I suggest that you implement validation at the data source level. This is the best solution in this situation.
                                Thanks,
                                Uriah.