public static MvcHtmlString CheckBoxListFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, List <SelectListItem> items, string cssClass = null, bool disabled = false) { ModelMetadata metadata = ModelMetadata.FromLambdaExpression <TModel, TProperty>(expression, htmlHelper.ViewData); string name = ExpressionHelper.GetExpressionText(expression); string fullHtmlFieldName = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(name); return(ListControlUtil.GenerateHtml(fullHtmlFieldName, items, ControlType.CheckBox, metadata.Model, cssClass, disabled)); }
public static MvcHtmlString CheckBoxList(this HtmlHelper htmlHelper, string name, List <SelectListItem> items, string cssClass = null, bool disabled = false) { return(ListControlUtil.GenerateHtml(name, items, ControlType.CheckBox, null, cssClass, disabled)); }