TextBox..::.AutoCompleteType 属性
来源:互联网 发布:网络用语飒是什么意思 编辑:程序博客网 时间:2024/05/27 20:52
获取或设置一个值,该值指示 TextBox 控件的 AutoComplete 行为
命名空间: System.Web.UI.WebControls
程序集: System.Web(在 System.Web.dll 中)
<ThemeableAttribute(False)> _Public Overridable Property AutoCompleteType As AutoCompleteType
Dim instance As TextBoxDim value As AutoCompleteTypevalue = instance.AutoCompleteTypeinstance.AutoCompleteType = value
[ThemeableAttribute(false)]public virtual AutoCompleteType AutoCompleteType { get; set; }
[ThemeableAttribute(false)]public:virtual property AutoCompleteType AutoCompleteType { AutoCompleteType get (); void set (AutoCompleteType value);}
/** @property *//** @attribute ThemeableAttribute(false) */public AutoCompleteType get_AutoCompleteType()/** @property *//** @attribute ThemeableAttribute(false) */public void set_AutoCompleteType(AutoCompleteType value)
public function get AutoCompleteType () : AutoCompleteTypepublic function set AutoCompleteType (value : AutoCompleteType)
<asp:TextBox AutoCompleteType="AutoCompleteType" />
属性值
类型:System.Web.UI.WebControls..::.AutoCompleteTypeSystem.Web.UI.WebControls..::.AutoCompleteType 枚举值之一,指示 TextBox 控件的 AutoComplete 行为。默认值为 None。
为协助完成数据输入,Microsoft Internet Explorer 5 和更高版本以及某些其他浏览器都支持一种称为“自动完成”的功能。“自动完成”监视一个文本框并创建用户输入的值的列表。用户在以后返回该文本框时,会显示该列表。用户只需从此列表选择值,而不用重新键入以前输入过的值。使用 AutoCompleteType 属性来控制 TextBox 控件的自动完成功能的行为。System.Web.UI.WebControls..::.AutoCompleteType 枚举用于表示可以应用到 AutoCompleteType 属性的值。
说明: |
---|
不是所有的浏览器都支持自动完成功能。请检查浏览器以确定兼容性。 |
默认情况下,TextBox 控件的 AutoCompleteType 属性设置为 AutoCompleteType.None。使用该设置,TextBox 控件与不同页面上具有相同 ID 属性的其他 TextBox 控件共享该列表。也可以根据类别,而不是根据 ID 属性,在 TextBox 控件之间共享列表。将 AutoCompleteType 属性设置为类别值(如 AutoCompleteType.FirstName、AutoCompleteType.LastName 等)之一时,所有相同类别的 TextBox 控件将共享同一个列表。通过将 AutoCompleteType 属性设置为 AutoCompleteType.Disabled,可以禁用 TextBox 控件的自动完成功能。
有关配置和启用自动完成功能的详细信息,请参考浏览器文档。例如,若要启用 Internet Explorer 5 版或更高版本中的自动完成功能,请从“工具”菜单中选择“Internet 选项”,然后选择“内容”选项卡。单击“自动完成”按钮,查看并修改自动完成功能的各种浏览器选项。
有关 Internet Explorer 中“自动完成”功能的更多信息,请在 MSDN Library 中搜索“Using AutoComplete in HTML Forms”(在 HTML 窗体中使用自动完成)。
无法通过主题或样式表主题设置此属性。有关更多信息,请参见 ThemeableAttribute和 ASP.NET 主题和外观概述。
下面的代码示例演示如何使用 AutoCompleteType 枚举来指定 TextBox 控件的 AutoComplete 类别。
安全说明: |
---|
此示例有一个接受用户输入的文本框,这是一个潜在的安全威胁。默认情况下,ASP.NET 网页验证用户输入是否不包括脚本或 HTML 元素。有关更多信息,请参见脚本侵入概述。 |
<%@ Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html > <head runat="server"> <title>AutoCompleteType example</title></head><body> <form id="form1" runat="server"> <!-- You need to enable the AutoComplete feature on --> <!-- a browser that supports it (such as Internet --> <!-- Explorer 5.0 and later) for this sample to --> <!-- work. The AutoComplete lists are created after --> <!-- the Submit button is clicked. --> <h3>AutoCompleteType example</h3> Enter values in the text boxes and click the Submit <br/> button. <br/><br/> <!-- The following TextBox controls have different --> <!-- categories assigned to their AutoCompleteType --> <!-- properties. --> First Name:<br/> <asp:textbox id="FirstNameTextBox" autocompletetype="FirstName" runat="server"/> <br/> Last Name:<br/> <asp:textbox id="LastNameTextBox" autocompletetype="LastName" runat="server"/> <br/> Email:<br/> <asp:textbox id="EmailTextBox" autocompletetype="Email" runat="server"/> <br/> <!-- The following TextBox controls have the same --> <!-- categories assigned to their AutoCompleteType --> <!-- properties. They share the same AutoComplete --> <!-- list. --> Phone Line #1:<br/> <asp:textbox id="Phone1TextBox" autocompletetype="HomePhone" runat="server"/> <br/> Phone Line #2:<br/> <asp:textbox id="Phone2TextBox" autocompletetype="HomePhone" runat="server"/> <br/> <!-- The following TextBox control has its --> <!-- AutoCompleteType property set to --> <!-- AutoCompleteType.None. All TextBox controls --> <!-- with the same ID across different pages share --> <!-- the same AutoComplete list. --> Category:<br/> <asp:textbox id="CategoryTextBox" autocompletetype="None" runat="server"/> <br/> <!-- The following TextBox control has the --> <!-- AutoComplete feature disabled. --> Comments:<br/> <asp:textbox id="CommentsTextBox" autocompletetype="Disabled" runat="server"/> <br/> <br/><br/> <asp:button id="SubmitButton" text="Submit" runat="Server"/> </form> </body></html>
<%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html > <head runat="server"> <title>AutoCompleteType example</title></head><body> <form id="form1" runat="server"> <!-- You need to enable the AutoComplete feature on --> <!-- a browser that supports it (such as Internet --> <!-- Explorer 5.0 and later) for this sample to --> <!-- work. The AutoComplete lists are created after --> <!-- the Submit button is clicked. --> <h3>AutoCompleteType example</h3> Enter values in the text boxes and click the Submit <br/> button. <br/><br/> <!-- The following TextBox controls have different --> <!-- categories assigned to their AutoCompleteType --> <!-- properties. --> First Name:<br/> <asp:textbox id="FirstNameTextBox" autocompletetype="FirstName" runat="server"/> <br/> Last Name:<br/> <asp:textbox id="LastNameTextBox" autocompletetype="LastName" runat="server"/> <br/> Email:<br/> <asp:textbox id="EmailTextBox" autocompletetype="Email" runat="server"/> <br/> <!-- The following TextBox controls have the same --> <!-- categories assigned to their AutoCompleteType --> <!-- properties. They share the same AutoComplete --> <!-- list. --> Phone Line #1:<br/> <asp:textbox id="Phone1TextBox" autocompletetype="HomePhone" runat="server"/> <br/> Phone Line #2:<br/> <asp:textbox id="Phone2TextBox" autocompletetype="HomePhone" runat="server"/> <br/> <!-- The following TextBox control has its --> <!-- AutoCompleteType property set to --> <!-- AutoCompleteType.None. All TextBox controls --> <!-- with the same ID across different pages share --> <!-- the same AutoComplete list. --> Category:<br/> <asp:textbox id="CategoryTextBox" autocompletetype="None" runat="server"/> <br/> <!-- The following TextBox control has the --> <!-- AutoComplete feature disabled. --> Comments:<br/> <asp:textbox id="CommentsTextBox" autocompletetype="Disabled" runat="server"/> <br/> <br/><br/> <asp:button id="SubmitButton" text="Submit" runat="Server"/> </form> </body></html>
- TextBox..::.AutoCompleteType 属性
- textbox有个AutoCompleteType的属性
- AutoCompleteType防止textbox“自动完成”
- AutoCompleteType
- textbox的ontextchange属性。
- TextBox的ReadOnly属性
- TextBox 数字属性
- TextBox属性的学习
- Textbox控件常用属性
- 关于TextBox.Locked属性
- textbox的属性设置
- asp:textbox 的属性
- TextBox的EnableViewState属性问题
- WPF之TextBox相关属性
- C#设置textBox字体属性
- easyui textbox动态添加属性
- 为TextBox增加隐藏属性,Value属性
- 实用的TextBox控件的Undo属性
- 中文乱码处理办法
- 武术中的“气” 和“内功” 两个概念
- voip
- C#编码好习惯(转)
- No entry for BW_USER in table RSADMIN available
- TextBox..::.AutoCompleteType 属性
- 星期一
- 对《自定义GridView分页模板中页码Button的实现》中程序的改进,追加显示空行功能
- 线程
- Spring事务管理
- 贝尔实验室:C语言的诞生
- MFC 工具栏 Toolbar 自定义 位图 Bitmap
- J2EE架构数据表示:Struts+Hibernate
- 一个Excel和DataSet相互转化的类