As a developer, you may want to disable this feature for some types of input including credit card information. ASP.NET has the ability to override the user's choice with the autocomplete attribute by setting it to off. This can be added to a form tag or an individual TextBox control.
Examples:
<form runat="server" autocomplete="off"></form>
<asp:TextBox ID="tbCreditCardNumber" runat="server" autocomplete="off" />
(Runtime)
tbCreditCardNumber.Attributes.Add( "autocomplete", "off" );
Alternatively, you can use the AutoCompleteType attribute on an individual TextBox control and set it to Disabled to achieve the same result.
Example:
<asp:TextBox ID="tbCreditCardNumber" runat="server" AutoCompleteType="Disabled" />
(Runtime)
tbCreditCardNumber.AutoCompleteType = AutoCompleteType.Disabled;
5 comments:
is it possible to turn on autocomplete for a text box while its form autocomplete set turned-off
I don't think so. If you only want one control to have AutoComplete, disable it on all the others individually.
Thank you for posting this - saved me a lot of time trying to figure it out! No more worries about users leaving private info for others to discover.
Thanx for this awesome example!
its good.
easy to use.
straight to the point
fanx a mil :D
Doesn't work in asp.net 2.0. The auto complete attribute disappear at runtime
Post a Comment