C# 如何使HTML.EditorFor文本框存在于多行中?
我有一个文本区域,用户必须在其中编写描述。我想知道如何设置一个文本框,使其位于多行上,允许用户看到他们正在写什么。我所寻找的与我写这个问题的环境相似C# 如何使HTML.EditorFor文本框存在于多行中?,c#,asp.net,asp.net-mvc,razor,web-deployment,C#,Asp.net,Asp.net Mvc,Razor,Web Deployment,我有一个文本区域,用户必须在其中编写描述。我想知道如何设置一个文本框,使其位于多行上,允许用户看到他们正在写什么。我所寻找的与我写这个问题的环境相似 <div class="form-group"> <div class="col-md-10"> @Html.EditorFor(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>
@EditorFor(model=>model.Title,new{htmlAttributes=new{@class=“form control”})
在您的模型中,您需要添加MultilineText,如下所示:
[DataType(DataType.MultilineText)]
public string Title { get; set; }
在您的模型中,您需要添加MultilineText,如下所示:
[DataType(DataType.MultilineText)]
public string Title { get; set; }
或者您的代码刚刚将EditorFor更改为TextAreaFor,如下所示
@Html.TextAreaFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
或者您的代码刚刚将EditorFor更改为TextAreaFor,如下所示
@Html.TextAreaFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
你需要一个文本区,对吗?你需要一个文本区,对吗?