Nidheesh
Nidheesh

Reputation: 426

How to set Default name in textbox in asp.net mvc3 razor

In my project login Form i have to implement Default Display and when we click on the textbox ,textbox has to be in blank and vice - versa.This is my code

<li><i class="icon-user"></i>@Html.TextBoxFor(Model => Model.UserName, new { @class = "login-user-input", autocomplete = "off", @value="UserName"})</li>

                            <li><i class="icon-key"></i> @Html.TextBoxFor(Model => Model.Password, new { @class = "login-user-input", autocomplete = "off" })</li>

Upvotes: 1

Views: 293

Answers (1)

Satpal
Satpal

Reputation: 133453

You can use placeholder attribute

@Html.TextBoxFor(Model => Model.UserName,
    new { 
        @class = "login-user-input", 
        autocomplete = "off", 
        placeholder="UserName"
    })

Upvotes: 4

Related Questions