Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Textbox auto fill in asp.net

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.

like image 615
reaz Avatar asked Mar 30 '13 08:03

reaz


2 Answers

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>
like image 188
enb081 Avatar answered Oct 21 '22 16:10

enb081


<asp:TextBox Runat="Server" ID="xyz" autocomplete="off" />

Or try this In From Tag

<form autocomplete="off" ...
like image 45
Chetan Sanghani Avatar answered Oct 21 '22 16:10

Chetan Sanghani