public static AjaxRadioList <T> Combobox <T>(this AjaxRadioList <T> arl, Action <OdropdownCfg> setCfg = null)
        {
            arl.Mod("awem.combobox");
            var odcfg = new OdropdownCfg();

            if (setCfg != null)
            {
                setCfg(odcfg);
                arl.Tag(odcfg.ToTag());
            }

            return(arl);
        }
        public static AjaxRadioList <T> ButtonGroup <T>(this AjaxRadioList <T> arl, Action <OdropdownCfg> setCfg = null)
        {
            arl.Mod("awem.buttonGroupRadio");
            var odcfg = new OdropdownCfg();

            if (setCfg != null)
            {
                setCfg(odcfg);
                arl.Tag(odcfg.ToTag());
            }

            return(arl);
        }
示例#3
0
        /// <summary>
        /// timepicker extension
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="arl"></param>
        /// <param name="setCfg"></param>
        /// <returns></returns>
        public static AjaxRadioList <T> TimePicker <T>(this AjaxRadioList <T> arl, Action <TimePickerCfg> setCfg = null)
        {
            arl.Mod("awem.timepicker");
            arl.UnobsValid(false);

            var cfg = new TimePickerCfg();
            var tag = new TimePickerTag();

            if (setCfg != null)
            {
                setCfg(cfg);
                tag = cfg.ToTag();
            }

            var cformat = Autil.CurrentCulture().DateTimeFormat;
            var isAmPm  = cformat.ShortTimePattern.Contains("h");

            if (isAmPm)
            {
                tag.AmPm = new[] { cformat.AMDesignator, cformat.PMDesignator };
            }

            arl.Tag(tag);

            arl.ValueRenderer(
                o =>
            {
                if (o != null)
                {
                    if (o is DateTime)
                    {
                        return(((DateTime)o).ToString(cformat.ShortTimePattern));
                    }

                    return(o.ToString());
                }

                return(string.Empty);
            });
            return(arl);
        }