Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public DropDownList <T, TProperty> BindTo(IEnumerable <SelectListItem> items)
 {
     _collection = new DropDownListItemCollection(htmlHelper, items);
     return(this);
 }
Exemplo n.º 3
0
 public DropDownList <T, TProperty> Items(Action <DropDownListItemCollection> itemsAction)
 {
     _collection = new DropDownListItemCollection(htmlHelper, itemsAction);
     return(this);
 }