private void validationProvider1_ValidationFailed(object sender, ValidationFailedEventArgs e)
        {
            BaseEdit edit = e.InvalidControl as BaseEdit;

            if (edit == null)
            {
                return;
            }

            BaseEditViewInfo viewInfo = edit.GetViewInfo() as BaseEditViewInfo;

            if (viewInfo == null)
            {
                return;
            }

            if (edit.ToolTipController == null)
            {
                edit.ToolTipController = new ToolTipControllerDefault();
            }

            ToolTipControlInfo info = new ToolTipControlInfo(e.InvalidControl, e.ErrorText);

            info.ToolTipPosition = edit.PointToScreen(viewInfo.ErrorIconBounds.Location);

            edit.ToolTipController.InitialDelay = 0;
            edit.ToolTipController.ShowHint(info);
        }
예제 #2
0
        /// <summary>
        ///   Is subscribed to the EventBroker validation failed event.
        ///   Pushes failures to the View.
        /// </summary>
        protected void ValidationFailedEvent(object sender, ValidationFailedEventArgs eventArgs)
        {
            this.AddValidationErrorToModelState(this._eventBroker.GetFailures());

            foreach (var failure in this.EventBroker.GetFailures().Where(x => x.Exception != null))
            {
                this.WriteExceptionToModelState(failure.Exception, 1);
            }

            // Don't display message in flash if the key is set
            if (eventArgs.HasMessage && string.IsNullOrWhiteSpace(eventArgs.Key))
            {
                switch (eventArgs.FlashLevel)
                {
                case ValidationFailedEventArgs.FlashLevelType.Error:
                    this.FlashError(eventArgs.DisplayMessage);
                    break;

                case ValidationFailedEventArgs.FlashLevelType.Warning:
                    this.FlashWarning(eventArgs.DisplayMessage);
                    break;

                case ValidationFailedEventArgs.FlashLevelType.Info:
                    this.FlashInfo(eventArgs.DisplayMessage);
                    break;
                }
            }
            else
            {
                this.FlashError("Validation Error");

                // IMPROVE: This is likely problematic.
                // it works for partials where the validation does not match, but will display these extra messages
                // even when the model state matches.
                foreach (var failure in this.EventBroker.GetFailures().Where(x => !string.IsNullOrWhiteSpace(x.Message)))
                {
                    this.FlashError(failure.Message);
                }
            }
        }
예제 #3
0
 private void dxValidadorNF_ValidationFailed(object sender, ValidationFailedEventArgs e)
 {
     this.isMovimentoValid = false;
 }