Multi-line text field in html <textarea> :
<%= Html.TextArea("Body", null, new { cols = "55", rows = "10" }) %>
or
<%= Html.TextArea("Body", null, 10, 55, null) %>
or even better:
<%= Html.TextAreaFor(x => x.Body, 10, 55, null) %>
And another possibility is to decorate your view model property with the [DataType] attribute:
[DataType(DataType.MultilineText)] public string Body { get; set; }
and in your opinion:
<%= Html.EditorFor(x => x.Body) %>
and set the width and height using CSS.
Darin Dimitrov Feb 16 '11 at 20:56 2011-02-16 20:56
source share