public static MvcHtmlString ExtEditorBasicFor <TModel, TValue>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, IEnumerable <TValue> > > expression, bool readOnly = false, object htmlAttributes = null) { var html = htmlAttributes == null ? new RouteValueDictionary() : new RouteValueDictionary(htmlAttributes); 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>"); if (readOnly) { stringBuilder.AppendLine(string.Format("CKEDITOR.replace('{0}', {{ customConfig: 'config-basic.js', readOnly: true }})", controlId)); } else { stringBuilder.AppendLine(string.Format("CKEDITOR.replace('{0}', {{ customConfig: 'config-basic.js' }})", controlId)); } stringBuilder.AppendLine("</script>"); return(CustomControlHelper.GenerateWithValidationMessage(htmlHelper, stringBuilder.ToString(), expression)); }
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)); }