-->

01 May 2021

DISABLE BROWSER AUTOCOMPLETE FEATURE IN TEXTBOX IN ASP.NET

  Asp.Net CS By Example       01 May 2021

DISABLE BROWSER AUTOCOMPLETE FEATURE IN TEXTBOX IN ASP.NET

 In this post, I am going to explain How to disable, stop or turn off the auto complete or auto fill feature in input controls e.g. TextBox controls in asp.net using C# languages.

 The web browsers such as Google Chrome, Mozilla Firefox and Internet Explorer etc has a default Auto complete feature that stores the filled information in browser cache and show that previously filled data when we start typing again in those fields e.g. TextBox controls in asp.net web pages.

 There are three ways to turn off autocomplete="off" or autocomplete="cc-csc" feature that is listed below. Just choose any one of these. You want known more abount autocomplete more value list click here.

   1) Setting the autocomplete="off" or autocomplete="cc-csc" in the Form tag to disable autocomplete on entire form as:

  <form id="form1" method="post" runat="server" autocomplete="off" > 

   2) Setting the autocomplete="off"in all the Textbox controls where we want to disable autocomplete as:

  <asp:TextBox ID="txtName" runat="server" autocomplete="off" /> 

   3) At run time turning this feature off via the attributes of the controls in the code behind as:

  txtName.Attributes.Add("autocomplete", "off"); 

 We have demonstrated all the three methods to turn off the auto complete feature in the example above. We just need to use any one of these methods. Now run the web Page and enter any record and click on submit. Refresh the browser by pressing F5 and again try to enter the same record and we will see previously filled data is not showing while entering.

logoblog

Thanks for reading DISABLE BROWSER AUTOCOMPLETE FEATURE IN TEXTBOX IN ASP.NET

Previous
« Prev Post

No comments:

Post a Comment

Please do not enter any spam link in the comment box.