Disable browser's autocomplete textboxes in asp.net c#

November 22, 2016, at 10:03 AM

How to disable browser's autocomplete effect on all textboxes in asp.net c# application. I have tried following jquery but it doesn't works

$(document).ready(function () {
    $("input[type=text]").attr("autocomplete", "off");

Please help me !!!

Answer 1

Add autocomplete="off" attribute in input control.

<input autocomplete="off" id="name" type="text" name="name">
Answer 2

If you are using c#, you can use this code inside the form. This will disable all the controls autocomplete inside the form.

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

If you want to disable individually, you can use this code.

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

Or you can change the autocomplete at run time:

Textbox1.Attributes.Add("autocomplete", "off");
Answer 3

Set the ViewStateMode property of the textbox to Disabled . Should work for you.

Rent Charter Buses Company
Validate Input only on blur or loose focus

Validate Input only on blur or loose focus

I am using - victorjonsson/jQuery-Form-Validator.

won&#39;t redirect anymore - 302 status code

won't redirect anymore - 302 status code

Hey guys I got a 302 error code when I want to redirect my page, I'm using header().