ContosoUniversity icon indicating copy to clipboard operation
ContosoUniversity copied to clipboard

FormBlocks

Open TDK1964 opened this issue 8 years ago • 1 comments

Hi Jimmy, I've been reading you articles about templates and like the way you did the FormBlock code. However, I can't seem to get a textarea to display. I've added [DataType(DataType.MultilineText)] to my model property but it seems to ignore it. Should I extend your example and create a specific "TextAreaBlock" or something else?

TDK1964 avatar Jun 01 '16 15:06 TDK1964

TDK1964,

I am not sure if this is the "correct" way to do it, but I added the following code to the DefaultAspNetMvcHtmlConventions.cs file:

Editors.If(er => { var attr = er.Accessor.GetAttribute<DataTypeAttribute>(); return attr != null && attr.DataType == DataType.MultilineText; }).ModifyWith(m => m.CurrentTag.TagName("textarea").Attr("rows", "3"));

StrykerNinja avatar Sep 01 '16 20:09 StrykerNinja