コード例 #1
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(DayOfWeek?model)
        {
            List <SelectionItem <int?> > list = new List <SelectionItem <int?> >();

            list.Add(new SelectionItem <int?> {
                Text = Formatting.GetDayName(DayOfWeek.Monday), Value = (int)DayOfWeek.Monday
            });
            list.Add(new SelectionItem <int?> {
                Text = Formatting.GetDayName(DayOfWeek.Tuesday), Value = (int)DayOfWeek.Tuesday
            });
            list.Add(new SelectionItem <int?> {
                Text = Formatting.GetDayName(DayOfWeek.Wednesday), Value = (int)DayOfWeek.Wednesday
            });
            list.Add(new SelectionItem <int?> {
                Text = Formatting.GetDayName(DayOfWeek.Thursday), Value = (int)DayOfWeek.Thursday
            });
            list.Add(new SelectionItem <int?> {
                Text = Formatting.GetDayName(DayOfWeek.Friday), Value = (int)DayOfWeek.Friday
            });
            list.Add(new SelectionItem <int?> {
                Text = Formatting.GetDayName(DayOfWeek.Saturday), Value = (int)DayOfWeek.Saturday
            });
            list.Add(new SelectionItem <int?> {
                Text = Formatting.GetDayName(DayOfWeek.Sunday), Value = (int)DayOfWeek.Sunday
            });

            list.Insert(0, new SelectionItem <int?> {
                Text  = __ResStr("default", "(select)"),
                Value = null,
            });
            return(await DropDownListIntNullComponent.RenderDropDownListAsync(this, (int?)model, list, "yt_dayofweek"));
        }
コード例 #2
0
        /// <summary>
        /// Called by the framework when the component needs to be rendered as HTML.
        /// </summary>
        /// <param name="model">The model being rendered by the component.</param>
        /// <returns>The component rendered as HTML.</returns>
        public async Task <string> RenderAsync(int?model)
        {
            List <SelectionItem <int?> > list = new List <SelectionItem <int?> >();

            for (int i = 1; i <= 31; ++i)
            {
                list.Add(new SelectionItem <int?> {
                    Text = i.ToString(), Value = i
                });
            }
            list.Insert(0, new SelectionItem <int?> {
                Text  = __ResStr("default", "(select)"),
                Value = null,
            });
            return(await DropDownListIntNullComponent.RenderDropDownListAsync(this, (int?)model, list, "yt_dayofmonth"));
        }