Asp.net MVC中关于@Html标签Label、Editor使用


<div class="form-group">
@Html.LabelFor(model => model.UserName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.UserName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.UserName, "", new { @class = "text-danger" })
</div>
</div>

<div class="form-group">
@Html.LabelFor(model => model.PassWord, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.PasswordFor(model => model.PassWord, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.PassWord, "", new { @class = "text-danger" })
</div>
</div>

原文地址:https://www.cnblogs.com/yachao1120/p/6541197.html