Exemplo n.º 1
0
        public static IHtmlString Label <TModel>(this HtmlHelpers <TModel> helper, string labelText, string labelFor, IDictionary <string, object> attributes)
        {
            if (String.IsNullOrEmpty(labelText))
            {
                throw new ArgumentException("Argument_Cannot_Be_Null_Or_Empty", "labelText");
            }

            labelFor = labelFor ?? labelText;

            var tag = new TagBuilder("label")
            {
                InnerHtml = String.IsNullOrEmpty(labelText) ? String.Empty : HttpUtility.HtmlEncode(labelText)
            };

            if (!String.IsNullOrEmpty(labelFor))
            {
                tag.MergeAttribute("for", labelFor);
            }
            tag.MergeAttributes(attributes, false);

            return(tag.ToHtmlString(TagRenderMode.Normal));
        }
Exemplo n.º 2
0
 public static IHtmlString HiddenFor <TModel, TProperty>(this HtmlHelpers <TModel> helper, Expression <Func <TModel, TProperty> > expression, IDictionary <string, object> htmlAttributes)
 {
     return(Hidden(helper, ExpressionHelper.GetExpressionText(expression), expression.Compile()(helper.Model), TypeHelper.ObjectToDictionary(htmlAttributes)));
 }
Exemplo n.º 3
0
 public static IHtmlString HiddenFor <TModel, TProperty>(this HtmlHelpers <TModel> helper, Expression <Func <TModel, TProperty> > expression, object htmlAttributes)
 {
     return(Hidden(helper, ExpressionHelper.GetExpressionText(expression), expression.Compile()(helper.Model), htmlAttributes));
 }
Exemplo n.º 4
0
 public static IHtmlString TextBox <TModel>(this HtmlHelpers <TModel> helper, string name, object value)
 {
     return(TextBox(helper, name, value, null));
 }
Exemplo n.º 5
0
 public static IHtmlString Password <TModel>(this HtmlHelpers <TModel> helper, string name, object value)
 {
     return(Password(helper, name, value, null));
 }
Exemplo n.º 6
0
 public static IHtmlString ListBoxFor <TModel, TProperty>(this HtmlHelpers <TModel> helper, Expression <Func <TModel, TProperty> > expression, IEnumerable <SelectListItem> selectList, object selectedValues, int size, bool allowMultiple)
 {
     return(ListBox(helper, ExpressionHelper.GetExpressionText(expression), selectList, selectedValues, size, allowMultiple));
 }
Exemplo n.º 7
0
 public static IHtmlString ListBox <TModel>(this HtmlHelpers <TModel> helper, string name, string defaultOption, IEnumerable <SelectListItem> selectList, object selectedValues, object htmlAttributes)
 {
     return(ListBox(helper, name, defaultOption, selectList, selectedValues, TypeHelper.ObjectToDictionary(htmlAttributes)));
 }
Exemplo n.º 8
0
 public static IHtmlString DropDownListFor <TModel, TProperty>(this HtmlHelpers <TModel> helper, Expression <Func <TModel, TProperty> > expression, string defaultOption, IEnumerable <SelectListItem> selectList, object selectedValue,
                                                               IDictionary <string, object> htmlAttributes)
 {
     return(DropDownList(helper, ExpressionHelper.GetExpressionText(expression), defaultOption, selectList, selectList, htmlAttributes));
 }
Exemplo n.º 9
0
 public static IHtmlString ListBox <TModel>(this HtmlHelpers <TModel> helper, string name, string defaultOption, IEnumerable <SelectListItem> selectList, object htmlAttributes)
 {
     return(ListBox(helper, name, defaultOption, selectList, null, htmlAttributes));
 }
Exemplo n.º 10
0
 public static IHtmlString ListBox <TModel>(this HtmlHelpers <TModel> helper, string name, IEnumerable <SelectListItem> selectList, IDictionary <string, object> htmlAttributes)
 {
     return(ListBox(helper, name, null, selectList, null, htmlAttributes));
 }
Exemplo n.º 11
0
 public static IHtmlString ListBoxFor <TModel, TProperty>(this HtmlHelpers <TModel> helper, Expression <Func <TModel, TProperty> > expression, IEnumerable <SelectListItem> selectList, IDictionary <string, object> htmlAttributes)
 {
     return(ListBox(helper, ExpressionHelper.GetExpressionText(expression), selectList, htmlAttributes));
 }
Exemplo n.º 12
0
        public static IHtmlString DropDownList <TModel>(this HtmlHelpers <TModel> helper, string name, Enum options, Enum currentValue, IDictionary <string, object> htmlAttributes)
        {
            var items = currentValue.ToSelectListItems(currentValue).ToList();

            return(BuildDropDownList(name, null, items, null, htmlAttributes));
        }
Exemplo n.º 13
0
 public static IHtmlString DropDownList <TModel>(this HtmlHelpers <TModel> helper, string name, Enum options, Enum currentValue, object htmlAttributes)
 {
     return(DropDownList(helper, name, options, currentValue, TypeHelper.ObjectToDictionary(htmlAttributes)));
 }
Exemplo n.º 14
0
 public static IHtmlString DropDownListFor <TModel, TProperty>(this HtmlHelpers <TModel> helper, Expression <Func <TModel, TProperty> > expression, object htmlAttributes)
 {
     return(DropDownListFor(helper, expression, TypeHelper.ObjectToDictionary(htmlAttributes)));
 }
Exemplo n.º 15
0
 public static IHtmlString DropDownListFor <TModel>(this HtmlHelpers <TModel> helper, Expression <Func <TModel, Enum> > expression)
 {
     return(DropDownListFor(helper, expression, new {}));
 }
Exemplo n.º 16
0
 public static IHtmlString Hidden <TModel>(this HtmlHelpers <TModel> helper, string name, object value)
 {
     return(Hidden(helper, name, value, null));
 }
Exemplo n.º 17
0
 public static IHtmlString Hidden <TModel>(this HtmlHelpers <TModel> helper, string name, object value, object htmlAttributes)
 {
     return(Hidden(helper, name, value, TypeHelper.ObjectToDictionary(htmlAttributes)));
 }
Exemplo n.º 18
0
 public static IHtmlString ListBoxFor <TModel, TProperty>(this HtmlHelpers <TModel> helper, Expression <Func <TModel, TProperty> > expression, string defaultOption, IEnumerable <SelectListItem> selectList, object selectedValues, object htmlAttributes)
 {
     return(ListBox(helper, ExpressionHelper.GetExpressionText(expression), defaultOption, selectList, selectedValues, htmlAttributes));
 }