Infragistics UltraValidator new

2019-07-25 08:17发布

I am using infragistics UltraValidator. I want to remove the text "validation failed with the following error(s)" from validate message box. please help me out

HERE IS THE CODE >>

private void uValidate_ValidationError(object sender, ValidationErrorEventArgs e){

        Infragistics.Win.Misc.ValidationSettings settings;
            settings = this.uValidate.GetValidationSettings( UltraTextEditor );
            settings.NotificationSettings.Action = Infragistics.Win.Misc.NotificationAction.MessageBox;
            settings.NotificationSettings.Caption = "Required Fields";
            settings.NotificationSettings.Text = "Select Customer";
    }


bool ValidateMyControls()
    {
        Infragistics.Win.Misc.Validation v = uValidate.Validate();

        return v.IsValid;
    }

uValidate is UltraValidator control

when the method ValidateMyControls() is triggered, I will get a message box, with a string on top "Validation failed with the following error(s):". This string i need to remove or edit.

Regards Anfil

1条回答
祖国的老花朵
2楼-- · 2019-07-25 08:55

Now I understand what's happening here.
You need to customize the resource string identified by:

"Validate_ErrorNotificationMessageHeader"

This is an internal string contained in the resources of the Infragistics.Win.Misc assembly and it is displayed automatically by the assembly before your message "Select Customer".

You could customize the string with the following instruction

ResourceCustomizer rc = Infragistics.Win.Misc.Resources.Customizer;
rc.SetCustomizedString("Validate_ErrorNotificationMessageHeader", "Your message here");

Every Infragistics assembly has a list of strings that can be customized in this way.
For a complete list of the resource strings available look here. (And this is only for WinForms).
The best method to handle this task is to create a generic method called just one time at the startup of your application (Something like GlobalAppUtility.SetInfragisticsResourceStrings(); )

查看更多
登录 后发表回答