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