Infragistics UltraValidator new

一世执手 提交于 2020-01-15 09:47:16

问题


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:


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(); )



来源:https://stackoverflow.com/questions/11715432/infragistics-ultravalidator-new

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!