Пример #1
0
        public static MvcHtmlString BuildDropDownListFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, Action <PFDropDownList> action = null)
        {
            var component = new PFDropDownList();

            component.SetPropertyFor(htmlHelper, expression);
            if (action != null)
            {
                action(component);
            }
            return(component.Html(htmlHelper, expression));
        }
Пример #2
0
        public static MvcHtmlString BuildDropDownList(this HtmlHelper htmlHelper, string name, object value = null, Action <PFDropDownList> action = null)
        {
            var component = new PFDropDownList();

            component.SetPropertyFor(htmlHelper, name);
            if (value != null)
            {
                component.SetSelectedValue(value.ToString());
            }
            if (action != null)
            {
                action(component);
            }
            return(component.Html(htmlHelper, name, value));
        }