![](/img/trans.png)
[英]Client-side validation difference between Html.TextBoxFor/Html.TextAreaFor and Html.EditorFor (with [DataType(DataType.MultilineText)])
[英]MultiLineText DataType Value not populating in TextAreaFor
@Html.TextAreaFor(a => a.Text, new { id = "SomeID", placeholder = "Text", Value = Model.Text})
@Html.TextAreaFor(m => m.UserName)
應該足夠了@Html.TextAreaFor(m => m.UserName)
MVC負責從模型到文本區域填充當前值。 使用{ @Value = Model.Text }
不適用於textarea,因為它不使用value屬性: 如何為html <textarea>添加默認值?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.