Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show password field for display only

I've created MVC5 app and I use the following code in create mode when user type passowrd(show asterisks ) and Its working fine .In display mode I want to display just the asterisks (not empty text box) for the field which the user type password ,how should I do that?

this is the code in the create

 <div class="form-group">
        @Html.LabelFor(model => model.Password, new { @class = "control-label col-md-2" })
        <div class="col-md-10">
           @Html.Password("password", "", new { id = "password", Textmode = "Password" })
        </div>
    </div>
like image 663
Jean Tehhe Avatar asked Jan 01 '26 02:01

Jean Tehhe


1 Answers

You can use placeholder attribute:

<div class="form-group">
        @Html.LabelFor(model => model.Password, new { @class = "control-label col-md-2" })
        <div class="col-md-10">
           @Html.Password("password", "", new { id = "password", placeholder = "***", Textmode = "Password" })

        //or for displaying, just type
        <label>*****</label>

        </div>
</div>
like image 163
Jeyhun Rahimov Avatar answered Jan 02 '26 16:01

Jeyhun Rahimov