Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
314
Validation of a custom user control
posted

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?

Parents
  • 18495
    Verified Answer
    posted

    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.

Reply Children
No Data