private void TextBoxItem_Validating(object sender, CancelEventArgs e)
        {
            FreeFormDateTimeProvider provider1 = this.Provider as FreeFormDateTimeProvider;

            if (provider1 != null)
            {
                provider1.TryParse();
            }
            else
            {
                MaskDateTimeProvider provider2 = this.Provider as MaskDateTimeProvider;
                if (provider2 == null || this.Value == null)
                {
                    return;
                }
                provider2.ValidateRange();
            }
        }
        protected virtual void CreateMaskProvider()
        {
            if (this.culture == null)
            {
                this.culture = CultureInfo.CurrentCulture;
            }
            if (this.mask == "s")
            {
                this.mask = "";
            }
            this.UnwireEvents();
            switch (this.maskType)
            {
            case MaskType.None:
                this.provider = (IMaskProvider) new TextBoxProvider(this);
                base.Text     = "";
                break;

            case MaskType.DateTime:
                if (string.IsNullOrEmpty(this.Mask))
                {
                    this.mask = "g";
                }
                MaskDateTimeProvider provider          = this.provider as MaskDateTimeProvider;
                MaskDateTimeProvider dateTimeProvider1 = this.culture.Calendar is PersianCalendar || this.culture.Calendar is UmAlQuraCalendar || this.culture.Calendar is HijriCalendar ? (MaskDateTimeProvider) new ArabicMaskDateTimeProvider(this.mask, this.culture, this) : new MaskDateTimeProvider(this.mask, this.culture, this);
                dateTimeProvider1.MaxDate = this.maxDate;
                dateTimeProvider1.MinDate = this.minDate;
                if (provider != null)
                {
                    dateTimeProvider1.value              = provider.value;
                    dateTimeProvider1.AutoCompleteYear   = provider.AutoCompleteYear;
                    dateTimeProvider1.AutoSelectNextPart = provider.AutoSelectNextPart;
                }
                this.provider = (IMaskProvider)dateTimeProvider1;
                base.Text     = this.provider.ToString(true, true);
                break;

            case MaskType.Numeric:
                if (string.IsNullOrEmpty(this.Mask))
                {
                    this.mask = "n0";
                }
                this.provider = (IMaskProvider) new NumericMaskTextBoxProvider(this.mask, this.culture, this);
                base.Text     = this.provider.ToString(true, true);
                break;

            case MaskType.Standard:
                if (string.IsNullOrEmpty(this.Mask))
                {
                    this.mask = "############";
                }
                this.provider = (IMaskProvider) new StandartMaskTextBoxProvider(this.mask, this.culture, this, this.allowPromptAsInput, this.promptChar, this.passwordChar, this.restrictToAscii);
                this.Text     = this.provider.ToString(true, true);
                break;

            case MaskType.Regex:
                if (string.IsNullOrEmpty(this.Mask))
                {
                    this.mask = "[A-z]";
                }
                this.provider = (IMaskProvider) new RegexMaskTextBoxProvider(this.mask, this.culture, this);
                base.Text     = this.provider.ToString(true, true);
                break;

            case MaskType.IP:
                this.provider = (IMaskProvider) new IPMaskTextBoxProvider(CultureInfo.InvariantCulture, this, this.allowPromptAsInput, ' ', this.passwordChar, this.restrictToAscii);
                base.Text     = this.provider.ToString(true, true);
                break;

            case MaskType.EMail:
                this.mask     = string.Empty;
                this.provider = (IMaskProvider) new EMailMaskTextBoxProvider(this.culture, this);
                base.Text     = this.provider.ToString(true, true);
                break;

            case MaskType.FreeFormDateTime:
                if (string.IsNullOrEmpty(this.Mask))
                {
                    this.mask = "g";
                    if (this.Parent != null && this.Parent.Parent != null)
                    {
                        if (this.Parent.Parent is RadDateTimePickerElement)
                        {
                            this.mask = "g";
                        }
                        else if (this.Parent.Parent is RadTimePickerElement)
                        {
                            this.mask = "t";
                        }
                    }
                }
                FreeFormDateTimeProvider dateTimeProvider2 = new FreeFormDateTimeProvider(this.mask, this.culture, this);
                dateTimeProvider2.MaxDate = this.maxDate;
                dateTimeProvider2.MinDate = this.minDate;
                this.provider             = (IMaskProvider)dateTimeProvider2;
                break;
            }
            this.OnMaskProviderCreated();
        }