I try to overwrite the default text on the messagebox validate method.
In the UltraValidator control I modified the NotificationSettings.Text propert to a new text. The messagebox is still showing the default text: "Validation filed with the following error(s):".
How can I overwrite this default text? Thanks! Herbert
Hi Herbert,
I am revisiting this thread to see if you have any further questions regarding this behavior.
As for my previous approach, it may appear somewhat indirect, but this is required due to the nature of the UltraValidator’s notification. Essentially, you could modify the notification’s text by creating a new ValidationSettings instance and modify the text property that is extended from this instance. This approach; however, only makes sense if you are validating a single control while providing a custom error message, as if you did this for each control you would receive a discrete notification box for each instance.
Example:Dim validationSettings1 = UltraValidator1.GetValidationSettings(UltraNumericEditor1) validationSettings1.IsRequired = True validationSettings1.ValidationTrigger = ValidationTrigger.Programmatic validationSettings1.NotificationSettings.Caption = "German Error Message" validationSettings1.NotificationSettings.Text = "Bitte Fehler korrigieren" validationSettings1.NotificationSettings.Action = NotificationAction.MessageBox
UltraValidator1.Validate(UltraNumericEditor1)
By default, the notification for the UltraValidator will create a new string via the string builder class and if implemented with multiple control instances, you will get the initial portion of the string, (“Validation failed with the following error(s):”) in addition to an additional line and validation error for every control instance where the UltraValidator was implemented, where the validation failed.
Modification of the starting string instance in this case is not actually extended from the control and if that behavior is necessary, you would essentially need to create a custom dialog and handle building the notification string manually, as is outlined in the code sample from our online documentation, (I have included the link again, below for reference).
Provide custom notification message for UltraValidator:http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/Infragistics2.Win.Misc.v11.2~Infragistics.Win.Misc.UltraValidator~ValidationGroups.html
I will also be following up with you regarding a product idea which I will be submitting on your behalf to have the behavior that you are expecting considered for implementation with the UltraValidator.
If you have any questions at all in the meantime, please let me know.
Sincerely,Chris KDeveloper Support EngineerInfragistics, Inc.www.infragistics.com/support
Hi Chris,
I think you are digging in too deep. There is just a simple sentence / property that should be updated in the message box. I have attached a picture that shows the problem.
Many thanks for your support!
Best, Herbert
I have determined that in order to provide a custom message for the UltraValidators notification, you would need to explicitly provide a message box containing your custom message; effectively by-passing the default message box used by the UltraValidator.
I have attached a modified version of your sample sample which demonstrates a simplified version of this procedure in addition to the following link to our online documentation article where this information was sourced. Note that this article also details a more extensive version of this sample for validating multiple controls.
Please find the sample attached.
Custom Notificaiton for the UltraValidator:http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/Infragistics2.Win.Misc.v11.2~Infragistics.Win.Misc.UltraValidator~ValidationGroups.html
If you have any questions at all regarding this approach, please let me know.
I am currently looking into this issue for you and I will be posting my findings on this thread.
If you have any further questions at all in the meantime, please let me know.
Hi Boris,
Thank you for your very fast help! Unfortunately this is not the problem I have. I'm attaching a small project that shows the Messagebox "Validation filed with the following error(s):" instead of "Bitte Fehler korrigieren".
Thanks for help! Best regards from Switzerland, Herbert