简体   繁体   中英

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>

In your model you need to add MultilineText as below:

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

或者您的代码刚刚将EditorFor更改为TextAreaFor,如下所示

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM