【发布时间】:2015-03-29 13:59:39
【问题描述】:
模型类
[Required(ErrorMessage = "Pass word is required")]
//[ValidatePasswordLength]
[DataType(DataType.Password)]
//[Display(Name = "Password")]
public string Password { get; set; }
查看
<div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.Password, new {@class="form-control",placeholder="Password" })
@Html.ValidationMessageFor(model => model.Password)
</div>
我用谷歌搜索了它。我发现使用 @html.Editor 而不是 @html.TextBoxFor 但我必须为文本框应用 css。
我使用了@Html.TextBoxFor(model => model.Password, new {@class="form-control",placeholder="Password" }),但没有应用 css。
我如何做到这一点?
【问题讨论】:
标签: asp.net asp.net-mvc razor