Erstellen Sie Passwort-Feld ein @html.TextBoxFor

Model-Klasse

[Required(ErrorMessage = "Pass word is required")]
//[ValidatePasswordLength]
[DataType(DataType.Password)]
//[Display(Name = "Password")]
public string Password { get; set; }

Ansicht

<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>

Ich es gegoogelt.Ich fand die Verwendung @html.Editor statt @html.TextBoxFor aber ich habe um css anzuwenden für textbox .

Ich verwendet @Html.TextBoxFor(model => model.Password, new {@class="form-control",placeholder="Password" }) aber css wird nicht angewendet.
Wie kann ich das erreichen?

InformationsquelleAutor King_Fisher | 2015-03-29
Schreibe einen Kommentar