示例#1
0
        public static MvcHtmlString ExtTextAreaFor <TModel, TValue>(this HtmlHelper <TModel> htmlHelper,
                                                                    Expression <Func <TModel, TValue> > expression, object htmlAttributes = null)
        {
            var html = HtmlAttributeHelper.AddDefaultClass(htmlAttributes);

            html = HtmlAttributeHelper.AddTextAreaStyle(html);
            var maxLength = expression.MaxLength();

            if (maxLength != 0)
            {
                html = HtmlAttributeHelper.AddMaxLength(html, maxLength);
            }

            return(CustomControlHelper.GenerateWithValidationMessage(htmlHelper,
                                                                     htmlHelper.TextAreaFor(expression, html).ToString(), expression));
        }
示例#2
0
        public static MvcHtmlString ExtEditorFullFor <TModel, TValue>(this HtmlHelper <TModel> htmlHelper,
                                                                      Expression <Func <TModel, IEnumerable <TValue> > > expression, bool readOnly = false, object htmlAttributes = null)
        {
            var html = HtmlAttributeHelper.AddDefaultClass(htmlAttributes);

            html = HtmlAttributeHelper.AddTextAreaStyle(html);

            var stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(htmlHelper.TextAreaFor(expression, html).ToString());


            var controlId = HtmlAttributeHelper.GetControlIdFromExpression(expression);

            stringBuilder.AppendLine("<script>");
            stringBuilder.AppendLine(readOnly
                ? $"CKEDITOR.replace('{controlId}', {{ readOnly: true }})"
                : $"CKEDITOR.replace('{controlId}')");
            stringBuilder.AppendLine("</script>");

            return(CustomControlHelper.GenerateWithValidationMessage(htmlHelper, stringBuilder.ToString(), expression));
        }