Abd*_*him 3 textarea html-helper asp.net-mvc-4
使用:ASP .NET MVC 4在我的一个页面中我需要一个具有一定宽度和高度的textarea使用html helper类.我的一些代码如下:
<div class="editor-label">
@Html.LabelFor(model => model.MailSubject)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.MailSubject)
@Html.ValidationMessageFor(model => model.MailSubject)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.MailBody)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.MailBody)
@Html.ValidationMessageFor(model => model.MailBody)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Content)
</div>
<div class="editor-field1">
@Html.EditorFor(model => model.Content)
@Html.ValidationMessageFor(model => model.Content)
</div>
Run Code Online (Sandbox Code Playgroud)
我想知道如何定义editorfor(model.content)的大小(宽度/隐藏)?
我意识到这个问题已经超过一年了,但万一有人正在寻找答案,这里是:
Html.TextAreaFor(model => model.Field, new { rows = "", cols = "", style = "width: 90%; height: 50px;" })
Run Code Online (Sandbox Code Playgroud)
您可以内联应用样式或使用类声明.这将在页面上呈现textarea,如下所示:
<textarea class="swiper-no-swiping" name="model.Field" cols="" rows="" style="width: 90%; height: 50px;"></textarea>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8148 次 |
| 最近记录: |