I\'m developing an ASP.NET MVC3 application using the new Razor view engine but I\'m having some difficulty changing a TextBox so that it is multiline. So far all I\'ve been ab
You could decorate the Body
property on your view model with the [DataType] attribute:
[DataType(DataType.MultilineText)]
public string Body { get; set; }
and in your view use the EditorFor helper instead of TextBoxFor:
@Html.EditorFor(model => model.Body)
Another possibility is to leave the model as is without adding any attributes to it and in your view use the TextAreaFor helper:
@Html.TextAreaFor(x => x.Body)
Personally I prefer the first approach.