/// <summary>
        /// Creates the control main element.
        /// </summary>
        /// <returns></returns>
        protected override IFWHtmlElement CreateControl()
        {
            var element = new FWDivElement();

            element.MergeAttributes(Attributes);
            if (!string.IsNullOrWhiteSpace(CustomCss))
            {
                element.AddCssClass(CustomCss);
            }

            element.Id       = Id;
            element.DataType = "fw-datepicker";

            element.AddCssClass("m-form__group form-group date date-picker");

            if (DisplayLabel)
            {
                var label = new FWLabelControl(Name, DisplayName, IsRequired, Tooltip);
                label.AddCssClass("control-label");
                element.Add(label.ToString());
            }

            var input = CreateDatepickerInput(element);
            //Adds the control icon
            var icon            = new FWTextboxIcon(_iconName);
            var iconPlaceholder = icon.Create(input);

            element.Add(iconPlaceholder.ToString());

            if (_minDate.HasValue)
            {
                element.Attributes.Add("data-mindate", _minDate.Value.ToString("yyyy-MM-dd"));
            }

            if (_maxDate.HasValue)
            {
                element.Attributes.Add("data-maxdate", _maxDate.Value.ToString("yyyy-MM-dd"));
            }

            if (_minDateControl != null)
            {
                element.Attributes.Add("data-mindate-target", _minDateControl);
            }

            if (_maxDateControl != null)
            {
                element.Attributes.Add("data-maxdate-target", _maxDateControl);
            }

            return(element);
        }
示例#2
0
 /// <summary>
 /// Sets an image for the textbox.
 /// </summary>
 /// <param name="icon">The image name.</param>
 /// <returns>The fluent configurator object.</returns>
 public FWTextboxControl Icon(string icon)
 {
     _icon = new FWTextboxIcon(icon);
     return(this);
 }
示例#3
0
 /// <summary>
 /// Sets an image for the currency control.
 /// </summary>
 /// <param name="icon">The image name.</param>
 /// <param name="background">Informs if the icon has a background or not.</param>
 /// <returns>The fluent configurator object.</returns>
 public FWCurrencyControl Icon(string icon = "fa fa-money", bool background = false)
 {
     _icon = new FWTextboxIcon(icon);
     return(this);
 }