コード例 #1
0
        public static SelectList FillTimeList(int starttime,int endtime, string Time)
        {
            DropDownListsRepository modelRepo = new DropDownListsRepository();
            var Firms = modelRepo.FillTimeList(starttime, endtime);

            List<SelectListItem> _Listfirms = new List<SelectListItem>();

                foreach (var item in Firms)
                {
                    SelectListItem itr = new SelectListItem();
                    itr.Text = item.TimeID;
                    itr.Value = item.TimeID.ToString();
                    itr.Selected = false;

                    _Listfirms.Add(itr);
                }

            return new SelectList(_Listfirms, "Value", "Text", Time);
        }