A text box automatically placed in a wrapper so that it is styled consistently across all browsers. If the width is set in pixels, this control automatically adjusts it, subtracting 6, to make the final resultant width be the given value. Widths less than 6 pixels are not supported.
Inheritance: System.Web.UI.WebControls.WebControl, ControlTreeDataLoader, FormControl, ControlWithJsInitLogic, ControlWithCustomFocusLogic
        void ControlTreeDataLoader.LoadData()
        {
            FormState.ExecuteWithDataModificationsAndDefaultAction(
                dataModifications,
                () => {
                CssClass = CssClass.ConcatenateWithSpace(CssElementCreator.CssClass);

                textBox = new EwfTextBox(
                    value.HasValue ? value.Value.ToMonthDayYearString() + " " + value.Value.ToHourAndMinuteString() : "",
                    disableBrowserAutoComplete: true,
                    autoPostBack: autoPostBack);
                Controls.Add(new ControlLine(textBox, getIconButton()));

                min = DateTime.MinValue;
                max = DateTime.MaxValue;
                if (constrainToSqlSmallDateTimeRange)
                {
                    min = Validator.SqlSmallDateTimeMinValue;
                    max = Validator.SqlSmallDateTimeMaxValue;
                }
                if (minDate.HasValue && minDate.Value > min)
                {
                    min = minDate.Value;
                }
                if (maxDate.HasValue && maxDate.Value < max)
                {
                    max = maxDate.Value;
                }

                if (ToolTip != null || ToolTipControl != null)
                {
                    new ToolTip(ToolTipControl ?? EnterpriseWebFramework.Controls.ToolTip.GetToolTipTextControl(ToolTip), this);
                }
            });
        }
        private Box test1( DataModification dm, Action<string> setValue )
        {
            var box = new EwfTextBox( "" );
            box.SetupAutoComplete( TestService.GetInfo(), AutoCompleteOption.NoPostBack );

            var dv = new DataValue<string>();
            dm.AddTopValidationMethod( ( pbvd, validator ) => dv.Value = box.GetPostBackValue( pbvd ) );
            dm.AddModificationMethod( () => setValue( dv.Value ) );

            return
                new Box(
                    "Autofill behavior. Typing more than 3 characters should bring up autofill options from a web service. " +
                    "Selecting an item or changing the text will no cause a post-back. This value show appear when submitting the page's submit button.",
                    box.ToSingleElementArray() );
        }
        void ControlTreeDataLoader.LoadData()
        {
            FormState.ExecuteWithDataModificationsAndDefaultAction(
                dataModifications,
                () => {
                CssClass = CssClass.ConcatenateWithSpace(CssElementCreator.CssClass);

                if (minuteInterval < 30)
                {
                    textBox = new EwfTextBox(
                        value.HasValue ? value.Value.ToTimeOfDayHourAndMinuteString() : "",
                        disableBrowserAutoComplete: true,
                        action: action,
                        autoPostBack: autoPostBack);
                    Controls.Add(new ControlLine(textBox, getIconButton()));
                }
                else
                {
                    var minuteValues = new List <int>();
                    for (var i = 0; i < 60; i += minuteInterval)
                    {
                        minuteValues.Add(i);
                    }
                    selectList = SelectList.CreateDropDown(
                        from hour in Enumerable.Range(0, 24)
                        from minute in minuteValues
                        let timeSpan = new TimeSpan(hour, minute, 0)
                                       select SelectListItem.Create <TimeSpan?>(timeSpan, timeSpan.ToTimeOfDayHourAndMinuteString()),
                        value,
                        width: Unit.Percentage(100),
                        placeholderIsValid: true,
                        placeholderText: "",
                        action: action,
                        autoPostBack: autoPostBack);
                    Controls.Add(selectList);
                }

                if (ToolTip != null || ToolTipControl != null)
                {
                    new ToolTip(ToolTipControl ?? EnterpriseWebFramework.Controls.ToolTip.GetToolTipTextControl(ToolTip), this);
                }
            });
        }
        void ControlTreeDataLoader.LoadData()
        {
            CssClass = CssClass.ConcatenateWithSpace( CssElementCreator.CssClass );

            if( minuteInterval < 30 ) {
                textBox = new EwfTextBox(
                    value.HasValue ? value.Value.ToTimeOfDayHourAndMinuteString() : "",
                    disableBrowserAutoComplete: true,
                    postBack: postBack,
                    autoPostBack: autoPostBack );
                Controls.Add( new ControlLine( textBox, getIconButton() ) );
            }
            else {
                var minuteValues = new List<int>();
                for( var i = 0; i < 60; i += minuteInterval )
                    minuteValues.Add( i );
                selectList = SelectList.CreateDropDown(
                    from hour in Enumerable.Range( 0, 24 )
                    from minute in minuteValues
                    let timeSpan = new TimeSpan( hour, minute, 0 )
                    select SelectListItem.Create<TimeSpan?>( timeSpan, timeSpan.ToTimeOfDayHourAndMinuteString() ),
                    value,
                    width: Unit.Percentage( 100 ),
                    placeholderIsValid: true,
                    placeholderText: "",
                    postBack: postBack,
                    autoPostBack: autoPostBack );
                Controls.Add( selectList );
            }

            if( ToolTip != null || ToolTipControl != null )
                new ToolTip( ToolTipControl ?? EnterpriseWebFramework.Controls.ToolTip.GetToolTipTextControl( ToolTip ), this );
        }
Esempio n. 5
0
 /// <summary>
 /// Creates a duration picker.
 /// </summary>
 public DurationPicker(TimeSpan value)
 {
     durationPicker = new EwfTextBox(Math.Floor(value.TotalHours).ToString("0000") + ":" + value.Minutes.ToString("00"));
 }
        void ControlTreeDataLoader.LoadData()
        {
            CssClass = CssClass.ConcatenateWithSpace( CssElementCreator.CssClass );

            textBox = new EwfTextBox(
                value.HasValue ? value.Value.ToMonthDayYearString() : "",
                disableBrowserAutoComplete: true,
                postBack: postBack,
                autoPostBack: autoPostBack );

            Controls.Add( new ControlLine( textBox, getIconButton() ) );

            min = DateTime.MinValue;
            max = DateTime.MaxValue;
            if( constrainToSqlSmallDateTimeRange ) {
                min = Validator.SqlSmallDateTimeMinValue;
                max = Validator.SqlSmallDateTimeMaxValue;
            }
            if( minDate.HasValue && minDate.Value > min )
                min = minDate.Value;
            if( maxDate.HasValue && maxDate.Value < max )
                max = maxDate.Value;

            if( ToolTip != null || ToolTipControl != null )
                new ToolTip( ToolTipControl ?? EnterpriseWebFramework.Controls.ToolTip.GetToolTipTextControl( ToolTip ), this );
        }
 /// <summary>
 /// Creates a duration picker.
 /// </summary>
 public DurationPicker( TimeSpan value )
 {
     durationPicker = new EwfTextBox( Math.Floor( value.TotalHours ).ToString( "0000" ) + ":" + value.Minutes.ToString( "00" ) );
 }