Mountain Man
Mountain Man

Reputation: 119

How do you make a HTML.EditorFor textbox exist on multiple lines?

I have a text area where users have to write a description. I was wondering how to set a text box so that it is on multiple lines, allowing the user to see what they are writing. What I am looking for is similar to the environment that I am writing this question in.

<div class="form-group">
    <div class="col-md-10">
        @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
    </div>
</div>

Upvotes: 0

Views: 1656

Answers (2)

Jephren Naicker
Jephren Naicker

Reputation: 356

Or you code have just changed the EditorFor to TextAreaFor like Below

 @Html.TextAreaFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })

Upvotes: 1

User3250
User3250

Reputation: 3423

In your model you need to add MultilineText as below:

[DataType(DataType.MultilineText)]
public string Title { get; set; }

Upvotes: 1

Related Questions