Exemplo n.º 1
0
        public static MvcHtmlString ListBoxSimple <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, IEnumerable <SelectListItem> selectList, string defaultValue, object htmlAttributes)
        {
            IEnumerable <SelectListItem> selectDefault = new SelectListItem[] { new SelectListItem {
                                                                                    Value = "", Text = defaultValue, Disabled = true
                                                                                } };

            selectDefault = selectDefault.Concat(selectList);
            return(htmlHelper.ListBoxFor(expression, selectDefault, htmlAttributes));
        }