简体   繁体   English

ASP.Net TextBox.AutoCompleteType属性-有用吗? 可定制的?

[英]ASP.Net TextBox.AutoCompleteType property - useful? customizable?

The ASP.Net TextBox control has an AutoCompleteType property that takes an AutoCompleteType enumeration value. ASP.Net TextBox控件具有一个AutoCompleteType属性,该属性采用AutoCompleteType枚举值。

First, is this property commonly used in actual development? 首先,此属性在实际开发中是否常用? Or is "browser autocomplete" turned off and Ajax autocomplete used instead? 还是关闭了“浏览器自动完成”功能,而使用了Ajax自动完成功能?

Second, are you constrained to only the values in the AutoCompleteType enum? 其次,您是否只限于AutoCompleteType枚举中的值? Can you extend the AutoCompleteType enum to contain custom values? 您可以扩展AutoCompleteType枚举以包含自定义值吗?

The AutoCompleteType enum is merely a simple way of referencing the autocomplete expando attribute exposed by the html tag. AutoCompleteType枚举仅仅是引用html标记公开的autocomplete expando属性的简单方法。 This attribute can be any string, with "off" being reserved for disabling the feature. 该属性可以是任何字符串,保留“ off”以禁用该功能。 Any textboxes that use a specific string will start autocompleting from the same shared list of previous entries. 任何使用特定字符串的文本框都将从先前条目的相同共享列表开始自动填充。

For example: If you set autocomplete on 2 boxes to "car", the next time you visit a form with another box with autocomplete set to "car" your previously used choices will become available. 例如:如果您将2个框中的自动完成设置为“汽车”,则下次访问带有自动完成设置为“汽车”的另一个框的表单时,以前使用的选项将变为可用。

Setting autocompletetype="disabled" didn't actually turn off auto complete in Firefox. 设置autocompletetype="disabled"实际上并没有在Firefox中关闭自动完成功能。 The only time autocompletetype works is when the client is using IE. autocompletetype只能在客户端使用IE时起作用。 (Yay asp.net browser sniffing.) (是asp.net浏览器嗅探。)

Using the non-standard attribute autocomplete="off" works -- and you can use this in your markup instead of using setattribute() . 使用非标准属性autocomplete="off"可以工作-您可以在标记中使用它而不是使用setattribute()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM