In this article we will explain how to disable auto-fill of textbox in asp.net with example.
Morden browsers like Chrome, Firefox, Internet Explorer and Safari has functionality of auto complete values in TextBoxes. If you have enabled this features in your browser, then each and every time when you start to enter value in TextBox you get a drop down of prefilled values in that TextBox. This feature of browser can be disabled by the programming for a specific web form like Login form and other confidential information form of a web application.
In chrome browser, we can disable auto-fill as shown below:
Suppose we have a below form for login to user account or admin account then it is mandatory to stop auto complete functionality of browser so that browser doesn’t save the confidential information of a user’s userid or password.
We can turn off auto-fill for our complete form by setting autocomplete attribute value to off as shown below:
<form id="form1" runat="server" autocomplete="off">
We can also turn off auto-fill for a particular TextBox by setting autocomplete attribute value to off as shown below:
<asp:TextBox ID="txtUserID" runat="server" autocomplete="off" />
After doing one of above code you will see that there is no auto-fill.
In this article, I explain how can you stop auto-complete in TextBox by programming. I hope you will use this technique in your web form.