コード例 #1
0
        public static MvcHtmlString CheckBoxListFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string codeCategory, RepeatDirection repeatDirection = RepeatDirection.Horizontal)
        {
            var codes             = CodeManager.GetCodes(codeCategory);
            var metadata          = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData);
            var name              = ExpressionHelper.GetExpressionText(expression);
            var fullHtmlFieldName = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(name);

            return(ListControlUtil.GenerateHtml(fullHtmlFieldName, codes, repeatDirection, "checkbox", metadata.Model));
        }
コード例 #2
0
        public static MvcHtmlString CheckBoxList(this HtmlHelper htmlHelper, string name, string codeCategory, RepeatDirection repeatDirection = RepeatDirection.Horizontal)
        {
            var codes = CodeManager.GetCodes(codeCategory);

            return(ListControlUtil.GenerateHtml(name, codes, repeatDirection, "checkbox", null));
        }