How can I change the size of a multi-line editor-f

2020-03-01 05:30发布

I'm working on an MVC project using C#. Right now, I'm trying to customize my views a little, and I'd like to make the text boxes bigger.

I followed the suggestions in this question to move from a single-line to a multi-line text field: Changing the size of Html.TextBox

Now I'm trying to resize that multi-line field, but I'm not sure where or how to do so.

Here are snippets from my Edit view

<div class="editor-label">
     @Html.LabelFor(model => model.Body)
</div>
<div class="editor-field">
     @Html.EditorFor(model => model.Body)
     @Html.ValidationMessageFor(model => model.Body)
</div>

and from my model:

[DataType(DataType.MultilineText)]  
[DisplayName("Body:")]  
public string Body { get; set; }

7条回答
Emotional °昔
2楼-- · 2020-03-01 06:34

You can also use @Html.TextArea ou TextAreaFor

@Html.TextAreaFor(model => model.Text, new { cols = 25, @rows = 5 })
查看更多
登录 后发表回答