如何使 HTML.EditorFor 文本框存在于多行中?
How do you make a HTML.EditorFor textbox exist on multiple lines?
我有一个文本区域,用户必须在其中编写描述。我想知道如何设置一个文本框,使其在多行上,让用户可以看到他们在写什么。我正在寻找的环境类似于我正在写这个问题的环境。
<div class="form-group">
<div class="col-md-10">
@Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
在您的模型中,您需要添加如下多行文本:
[DataType(DataType.MultilineText)]
public string Title { get; set; }
或者您的代码刚刚将 EditorFor 更改为 TextAreaFor,如下所示
@Html.TextAreaFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
我有一个文本区域,用户必须在其中编写描述。我想知道如何设置一个文本框,使其在多行上,让用户可以看到他们在写什么。我正在寻找的环境类似于我正在写这个问题的环境。
<div class="form-group">
<div class="col-md-10">
@Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
在您的模型中,您需要添加如下多行文本:
[DataType(DataType.MultilineText)]
public string Title { get; set; }
或者您的代码刚刚将 EditorFor 更改为 TextAreaFor,如下所示
@Html.TextAreaFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })