Example #1
0
        protected override void WriteEditor(TextWriter writer)
        {
            // Get the values
            IEnumerable <TValue> values = ModelMetadata.FromLambdaExpression(Expression, this.GetHtmlHelper <TModel>().ViewData).Model as IEnumerable <TValue>;

            if (values == null)
            {
                base.WriteEditor(writer);
                return;
            }

            // Iterate
            ComponentBuilder <MvcBootstrapConfig <TModel>, List> list = this.GetHelper <TModel>().List(_listType);
            int c = 0;

            foreach (TValue value in values)
            {
                list.AddChild(x => x.ListItem(new HtmlString(GetEditor(this.GetHtmlHelper <TModel>().EditorFor(_ => value, TemplateName, AdditionalViewData).ToString()))));
                c++;
            }
            list.GetComponent().StartAndFinish(writer);
        }