我知道您可以将DataType属性与EditorFor html帮助器一起使用,以指定模型实体的特定属性应显示为多行输入字段.
如果我想指定文本区域必须包含的行数和列数,该怎么办?
在模型中:
[DataType(DataType.MultilineText)] public string HTMLText { get; set; }
在视图中:
@Html.EditorFor(x => x.HTMLText)
通缉结果:
<textarea id="HTMLText" rows="10" cols="40">value</textarea>
解决方法
不确定如何设置行和列,但您可以使用.multi-line类更改这些textareas的CSS.使用EditorFor时,此类将添加到textarea中,以便您可以指定该类中的宽度和高度以获得所需的尺寸.
.multi-line { height:5em; width:5em; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。