/// <summary> /// Renders a Bootstrap text area. /// </summary> /// <param name="htmlHelper">The <see cref="T:Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper" /> instance this method extends.</param> /// <param name="expression">Expression name, relative to the current model.</param> /// <param name="value">If non-<c>null</c>, value to include in the element.</param> /// <param name="htmlAttributes"> /// An <see cref="T:System.Object" /> that contains the HTML attributes for the element. Alternatively, an /// <see cref="T:System.Collections.Generic.IDictionary`2" /> instance containing the HTML /// attributes. /// </param> /// <param name="rows">Number of rows in the text area.</param> /// <param name="configAction">Action that implements text area configuration.</param> /// <returns>Text area html markup.</returns> /// <remarks> /// <para> /// Combines <see cref="P:Microsoft.AspNetCore.Mvc.ViewFeatures.TemplateInfo.HtmlFieldPrefix" /> and <paramref name="expression" /> to set /// <textarea> element's "name" attribute. Sanitizes <paramref name="expression" /> to set element's "id" /// attribute. /// </para> /// <para>Determines <textarea> element's content based on the following precedence:</para> /// <list type="number"> /// <item> /// <see cref="T:Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary" /> entry for <paramref name="expression" /> (converted to a /// fully-qualified name) if entry exists and can be converted to a <see cref="T:System.String" />. /// </item> /// <item><paramref name="value" /> if non-<c>null</c>.</item> /// <item> /// <see cref="T:Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary" /> entry for <paramref name="expression" /> (converted to a /// fully-qualified name) if entry exists and can be converted to a <see cref="T:System.String" />. /// </item> /// <item> /// Linq expression based on <paramref name="expression" /> (converted to a fully-qualified name) run against /// current model if result is non-<c>null</c> and can be converted to a <see cref="T:System.String" />. For example /// <c>string.Empty</c> identifies the current model and <c>"prop"</c> identifies the current model's "prop" /// property. /// </item> /// <item>Otherwise, <c>string.Empty</c>.</item> /// </list> /// </remarks> public static IHtmlContent MvcCoreBootstrapTextArea(this IHtmlHelper htmlHelper, string expression, string value, object htmlAttributes, int rows = 3, Action <MvcCoreBootstrapTextAreaBuilder> configAction = null) { TextAreaConfig config = new TextAreaConfig { Rows = rows }; return(htmlHelper.Control(configAction, new MvcCoreBootstrapTextAreaBuilder(config), new TextAreaRenderer(config, new TooltipRenderer()), config, htmlHelper.TextArea(expression, value, htmlAttributes))); }
/// <summary> /// Renders a Bootstrap text area. /// </summary> /// <param name="htmlHelper">Html helper instance.</param> /// <param name="expression">Model property expression.</param> /// <param name="htmlAttributes"> /// An <see cref="T:System.Object" /> that contains the HTML attributes for the element. Alternatively, an /// <see cref="T:System.Collections.Generic.IDictionary`2" /> instance containing the HTML /// attributes. /// </param> /// <param name="rows">Number of rows in the text area.</param> /// <param name="configAction">Action that implements text area configuration.</param> /// <returns>Text area html markup.</returns> public static IHtmlContent MvcCoreBootstrapTextAreaFor <TModel, TResult>(this IHtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TResult> > expression, object htmlAttributes, int rows = 3, Action <MvcCoreBootstrapTextAreaBuilder> configAction = null) { TextAreaConfig config = new TextAreaConfig { HtmlAttributes = htmlAttributes, Rows = rows }; return(htmlHelper.ControlFor(expression, configAction, new MvcCoreBootstrapTextAreaBuilder(config), new TextAreaRenderer(config, new TooltipRenderer()), config)); }
internal MvcCoreBootstrapTextAreaBuilder(TextAreaConfig config) { _config = config; }
public TextAreaRenderer(TextAreaConfig config, ITooltipRenderer tooltipRenderer) : base(config, tooltipRenderer) { _config = config; }
public ReactiveTextAreaConfig(TextAreaConfig parent, Action action) { _parent = parent; _action = action; }