Html ASP.NET核心MVC中的多行文本框/输入字段
要创建多行输入字段,如ASP.NET MVC,我尝试了以下方法,但在ASP.NET核心MVC中无效:Html ASP.NET核心MVC中的多行文本框/输入字段,html,asp.net,asp.net-core,asp.net-core-mvc,Html,Asp.net,Asp.net Core,Asp.net Core Mvc,要创建多行输入字段,如ASP.NET MVC,我尝试了以下方法,但在ASP.NET核心MVC中无效: public class Post { [DataType(DataType.MultilineText)] public string Body { get; set; } } 他认为: <input asp-for="Body" rows="40" class="form-control"/> 如有任何建议,我们将不胜感激ASP.NET核心工具回购中存在漏洞
public class Post
{
[DataType(DataType.MultilineText)]
public string Body { get; set; }
}
他认为:
<input asp-for="Body" rows="40" class="form-control"/>
如有任何建议,我们将不胜感激ASP.NET核心工具回购中存在漏洞
建议的解决方法是使用
@Html.EditorFor(m => m.Body, additionalViewData: new { htmlAttributes = new { @class = "form-control" }})
或
还有使用
-标记的选项
它看起来是这样的:
<div class="form-group">
<label asp-for="Body">Opmerkingen</label>
<textarea asp-for="Body" class="form-control" text-wrap:normal" type="text" placeholder="Please add your experience here"></textarea>
<span asp-validation-for="Body" class="text-danger"></span>
</div>
奥默金根
<div class="form-group">
<label asp-for="Body">Opmerkingen</label>
<textarea asp-for="Body" class="form-control" text-wrap:normal" type="text" placeholder="Please add your experience here"></textarea>
<span asp-validation-for="Body" class="text-danger"></span>
</div>