Tuesday, March 3, 2009

Disable AutoComplete on Textbox

I had a Credit Card Number Textbox that was using AutoComplete to remember what was previously typed into the field. That can be really bad when the computer is in a public place like a library.

So in looking around I found a lot of people talk about putting autocomplete="off", not ="false" but ="off". That changed with ASP.NET 2.0. Now there is a field call AutoCompleteType with many settings, but one is "disabled". That is what you want.

<asp:TextBox ID="TextBoxCardNumber" runat="server" EnableViewState="false" AutoCompleteType="disabled"></asp:TextBox>

No comments:

Post a Comment