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
1725
WinValidators with grid numeric editors
posted

I'm trying to get the new 8.2 validators to work in some way that makes sense and (so far) without any luck.

What I have is a grid with multiple columns each with an assigned numeric editor. The editor has both right and left button collections (if that matters here). What I am trying to do is to (a) only show a validation error when the user exits edit mode on the editor (normally by tabbing out of the cell) and to show the user a "tip" that describes the error.Sounded "easy". The code I have is the following 

UltraNumericEditor numericEditor = new UltraNumericEditor();

numericEditor.AfterEditorButtonCloseUp += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.normalNumericEditor_AfterEditorButtonCloseUp);
numericEditor.BeforeEditorButtonDropDown += new Infragistics.Win.UltraWinEditors.BeforeEditorButtonDropDownEventHandler(this.normalNumericEditor_BeforeEditorButtonDropDown);
numericEditor.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.TasterResponseForm_HelpRequested);
numericEditor.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.normalNumericEditor_EditorButtonClick);
gridColumn.EditorControl = numericEditor;
ValidationSettings validationSettings = cellValidator.GetValidationSettings(numericEditor);
RangeCondition rangeCondition = validationSettings.Condition as RangeCondition;
if (null == rangeCondition)
{
    rangeCondition = new RangeCondition();
    rangeCondition.DataType = typeof(double);
    validationSettings.Condition = rangeCondition;
    validationSettings.IsRequired = false;
    validationSettings.NotificationSettings.Action = NotificationAction.Image; //NotificationAction.BalloonTip;
    validationSettings.ValidationTrigger = ValidationTrigger.OnValidating;
    validationSettings.RetainFocusOnError = true;
    validationSettings.NotificationSettings.Caption = "Validation Caption";
    validationSettings.NotificationSettings.Text = "Your value is bogus";
}
rangeCondition.MinimumValue = question.MinValue;
rangeCondition.MaximumValue = question.MaxValue; 

This is run against each of the columns during the grid initializelayout event.

I also have hooked up the validator Validating and ValidationError events to see what happens.

The result of the above is not what I want in a couple of ways

1)  The image (red x) is displayed in the cell as soon as the user types anything into the editor. This appears to be triggered by the property update (I'm assuming) and is not what I want to see (although the validation results..that is giving me the indication when the value exceeds the maximim as I'm typing away).

2)  There is no way that I can find to get any type of tip related to the error. If I set the notification action to MessageBox I do get a message box but that notification type is rather "rude" and I need to be able to mouse over the indication or get a balloon tip or something less anoying. 

What I also find is that the Validating and Validation error events are only being fired (as I expected) when the editor/cell is validated which (as I said in 1) is when I expected to see any validation error indications.

Am I just missing it?

Neil

Parents
No Data
Reply
  • 90
    Offline posted

    I am having the same issue as Neil with the

    The image (red x) is displayed in the cell as soon as the user types anything into the editor. This appears to be triggered by the property update (I'm assuming) and is not what I want to see (although the validation results..that is giving me the indication when the value exceeds the maximim as I'm typing away).

    I can trick it by having a "Blank" icon - but it takes up space in the cell (and in the balloon).

    Is there an easier way?

     

     

Children
No Data