I'm using the .net ajaxtoolkit control AutoCompleteExtender. It works great but my firefox autocomplete overrides the values that the extender is returning (the firefox one lays on top of the control's).
is th开发者_如何学运维ere a way to disable the browser's version of autocomplete so that the .net one takes precendence?
Try this:
<asp:TextBox ID="txtFirstName" runat="server" autocomplete="off" />
The trick is setting autocomplete="off"
.
Actually it is defined in HTML 5 standards, but should work in most modern browsers.
If you are using an ASP.Net TextBox, you can simply add the following attribute to the control:
AutoCompleteType="Disabled"
Looks something like this:
<asp:TextBox ID="tbFirstName" runat="server" AutoCompleteType="Disabled" />
EDIT:
The property above only works for IE based browsers. However, if you add this attribute to the control:
autocomplete="off"
It should work in FireFox and Chrome.
Had the same problem in FireFox.
I have set the attribute in the page OnPreRender. (in my case a usercontrol)
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
txtAutoComplete.Attributes.Add("autocomplete", "off");
}
Now it works like in IE.
Great!!
精彩评论