0

How do I set the TextBoxFor to hide the text when user types in a password?

@Html.TextBoxFor(model => model.Password.CurrentPassword, new { @class = "form-control", @placeholder = "Current Password", autocomplete = "off", name = "nconfirm" })

2 Answers 2

3
@Html.Password("password", "", new { id = "password", Textmode = "Password" })

This should help :)

Also, you can specify in your model that this is a password, like the answer in this post shows: asp.net mvc Razor TextBox

Sign up to request clarification or add additional context in comments.

Comments

1
@Html.PasswordFor(model => model.Password, new {@class="form-control", placeholder="Password"})

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.