ASP.NET AutoCompleteType 属性

定义和用法

AutoCompleteType 属性用于设置或返回 TextBox 控件的 AutoComplete 种类。

为了协助用户的数据输入,Microsoft Internet Explorer 5 及更高版本和 Netscape 都支持名为自动完成的功能。

AutoComplete 特性可创建在文本框中已输入的值列表。当再次使用该文本框时,已输入的值的列表或显示出来。用户可以直接选取值,而不需要重复键入之前已输入的值。

使用 AutoCompleteType 属性来控制 TextBox 控件的自动完成功能的行为。System.Web.UI.WebControls.AutoCompleteType 枚举用于表示可以应用到 AutoCompleteType 属性的值。

语法

<asp:TextBox AutoCompleteType="cat" runat="server"/>
属性 描述
cat

规定自动完成的种类。默认值为 None。

可能的值:System.Web.UI.WebControls.AutoCompleteType 枚举值之一。

实例

下面的例子把 AutoCompleteType 模式设置为 "HomePhone":

<form runat="server">
<asp:TextBox id="tb1" runat="server" AutoCompleteType="HomePhone" />
</form>

实例

设置 TextBox 控件的 AutoCompleteType 属性

AutoCompleteType 枚举

成员名称 说明
BusinessCity 办公地址所在城市类别。
BusinessCountryRegion 办公地址所在国家/地区类别。
BusinessFax 办公地址的传真号码类别。
BusinessPhone 办公地址的电话号码类别。
Category of the phone number of the business address. BusinessState
Category of the state where the business address is located. BusinessStreetAddress
Category of the street address where the business address is located. BusinessUrl
Category of the URL of the business website. BusinessZipCode
Category of the postal code of the business address. Cellular
Category of the mobile phone number. Company
Category of the enterprise name. Department
Category of the department within the enterprise. Disabled
Disable the automatic completion feature for the TextBox control. DisplayName
Category of the name displayed for the user. Email
Category of the user's email address. FirstName
Category of the user's name. Gender
Category of the user's gender. HomeCity
Category of the city where the home address is located. HomeCountryRegion
Category of the country/region where the home address is located. HomeFax
Category of the fax number of the home address. Homepage
Category of the URL of the website. HomePhone
Category of the phone number of the home address. HomeState
Category of the state where the home address is located. HomeStreetAddress
Category of the street address where the home address is located. HomeZipCode
Category of the postal code of the home address. JobTitle
Category of the user's job title. LastName
Category of the user's surname. MiddleName
Category of the user's middle name. None
No categories are associated with the TextBox control. All TextBox controls with the same ID share the same value list. Notes
Any additional information to be included in the form category. Office
Category of paging numbers. Pager
Search Keyword categories for searching web pages or websites.