Hi!
I have a form with some text editors and a custom made user control. This user control in turn has a couple of text editors of which one (lets's call it TextEditorA) is mandatory to fill in.
How do I set up validation of the form such that the validation result not only depends on the text editors of the form but also on TextEditorA in the user control?
If TextEditorA is not filled in I want the form validation to fail, and a fail indication at/of the TextEditorA (and not at/of the whole user control).
I currently have an UltraValidator in the user control that validates the mandatory text editor there. When clicking the mandatory text editor of the user control, but leaving it empty, the user control UltraValidator indicates that this text editor is not properly filled in. However the validation of the form does not fail. Can I make the UltraValidator of the form communicate with the UltraValidator of the user control? Should I expose some special property on the user control?
Ok. Thanks.
I was hoping that I somehow could make the ultra validator of the form aware of the user control in the designer so to speak, and then have the user control be in charge of its validation. (I couldn't tell how such a mechanic should look or work though, so I understand that there might be none.)
Your suggestion is however a fair solution. We just need to remember to set the validation requirements in the Form.Load event handler whenever we use the user control and want to include it in validations.
Hello Ulf,
Thank you for contacting Infragistics.
I think the easiest way to do what you want would be to expose the editors as read-only properties on the user control. You would then get rid of the UltraValidator on the user control and only use the form's UltraValidator.
In order to include the user control's editors in the validation, you will need to handle the Form.Load event and set the validation requirements in that handler.
Please let me know if you have any other questions about this.