public static MvcHtmlString CheckBoxList(this HtmlHelper htmlHelper, string name, string codeCategory, RepeatDirection repeatDirection = RepeatDirection.Horizontal)
        {
            RoadFlow.Platform.DictionaryBLL bll = new RoadFlow.Platform.DictionaryBLL();
            var codes = bll.GetListByCode(codeCategory);

            return(GenerateHtml(name, codes, repeatDirection, "checkbox", null));
        }
示例#2
0
        //街道统计
        public ActionResult Index()
        {
            StatisticsIndexViewModel viewModel = new StatisticsIndexViewModel();
            string ssjd = Request["ssjd"];

            RoadFlow.Platform.DictionaryBLL DictionaryBLL = new RoadFlow.Platform.DictionaryBLL();
            viewModel.ParaSSJD = new SelectList(DictionaryBLL.GetListByCode("SSJD").ToList <RoadFlow.Data.Model.DictionaryModel>(), "ID", "Title", ssjd);;
            viewModel.List     = BuildingsStreetStatisticsBLL.GetBySSJD(ssjd);
            return(View(viewModel));
        }
        public static MvcHtmlString CheckBoxListFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string codeCategory, RepeatDirection repeatDirection = RepeatDirection.Horizontal)
        {
            RoadFlow.Platform.DictionaryBLL bll = new RoadFlow.Platform.DictionaryBLL();
            var           codes             = bll.GetListByCode(codeCategory);
            ModelMetadata metadata          = ModelMetadata.FromLambdaExpression <TModel, TProperty>(expression, htmlHelper.ViewData);
            string        name              = ExpressionHelper.GetExpressionText(expression);
            string        fullHtmlFieldName = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(name);

            return(GenerateHtml(fullHtmlFieldName, codes, repeatDirection, "checkbox", metadata.Model));
        }