Create PassWord textBox in asp.net mvc3 Raxor

To create a Password Field in to the Raxor view Page you have to write this below code

@Html.PasswordFor (model => model.Password)

Now there is a alternative way also is there.
In your model class write tour password field property like

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

and in the razor file then youy have to just write

<
div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Password)
@Html.ValidationMessageFor(model => model.Password)

</div>

It will automatically take the"*" char when you enter your password value.Because you have already meke in the password property like
"
[DataType(DataType.Password)]
Ebook Download
View all
Learn
View all