6

Can anyone tell me how to disable autofill for text boxes in asp.net?

to get a better Idea :

In the Login webpage. When a user provides a username and password there is also a (Remember Me) check box for next time login... So far, everything is fine.

but the problem appears in the registration form, when the user opens the register page, both fields (username and password ) are filled out with the users name and password used for the previous login.

Does anyone have an idea about this problem?

Note: I have tried these two lines of code in page load event, but it didn't work.

txtUsername.Text="";
txtPassword.Text="";

I will appreciate every single answer.

4

3 回答 3

9

You can disable autofill for the TextBoxes by adding autocomplete="off":

<asp:TextBox Runat="server" ID="txtUsername" autocomplete="off"></asp:TextBox>

<asp:TextBox Runat="server" ID="txtPassword" autocomplete="off"></asp:TextBox>
于 2013-03-30T08:06:14.663 回答
4
<asp:TextBox Runat="Server" ID="xyz" autocomplete="off" />

Or try this In From Tag

<form autocomplete="off" ...
于 2013-03-30T08:43:20.543 回答
3

and for your from :

<form id="register" autocomplete="off" method="post" runat="server">
                      ^ THIS ATTR
于 2013-03-30T08:10:23.847 回答