开发者

ASP MVC TextBoxFor<> somehow remember old entered values

开发者 https://www.devze.com 2023-04-05 03:25 出处:网络
I have one partial view with two TextBoxFor<>. I notice that when I run my applic开发者_运维知识库ation in browser that text box remembers and display old entered values in text box. I want display

I have one partial view with two TextBoxFor<>. I notice that when I run my applic开发者_运维知识库ation in browser that text box remembers and display old entered values in text box. I want display clear text box but can't find why this is happening. I have tried with:

ModelState.Clear();

In post method but doesn't solve anything.

<td>@Html.TextBoxFor(x => x.Username, new { @class = "loginUsername", placeholder = "Email" })
            </td>
            <td>@Html.TextBoxFor(x => x.Password, new { @class = "loginPassword", placeholder = "Password", type = "password" })
            </td>


It might be due to a remember password feature of your browser being activated which automatically saves all username/password values on the client. You could append the autocomplete="off" attribute on your password field to avoid this from happening. This attribute is not standards compliant but most browsers respect it.

0

精彩评论

暂无评论...
验证码 换一张
取 消