Пример #1
0
        public DropDownList <T, TProperty> BindTo(T model, Expression <Func <T, IEnumerable <SelectListItem> > > expression)
        {
            _name = htmlHelper.NameFor(expression).ToString();
            _id   = htmlHelper.IdFor(expression).ToString();

            var compiled = expression.Compile();
            var list     = compiled(model);

            _collection = new DropDownListItemCollection(htmlHelper, list);

            return(this);
        }
Пример #2
0
 public DropDownList <T, TProperty> BindTo(IEnumerable <SelectListItem> items)
 {
     _collection = new DropDownListItemCollection(htmlHelper, items);
     return(this);
 }
Пример #3
0
 public DropDownList <T, TProperty> Items(Action <DropDownListItemCollection> itemsAction)
 {
     _collection = new DropDownListItemCollection(htmlHelper, itemsAction);
     return(this);
 }