Export (0) Print
Expand All

TextBox.AutoCompleteType Property

Gets or sets a value that indicates the AutoComplete behavior of the TextBox control

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[<ThemeableAttribute(false)>]
abstract AutoCompleteType : AutoCompleteType with get, set
[<ThemeableAttribute(false)>]
override AutoCompleteType : AutoCompleteType with get, set
<asp:TextBox AutoCompleteType="AutoCompleteType" />

Property Value

Type: System.Web.UI.WebControls.AutoCompleteType
One of the System.Web.UI.WebControls.AutoCompleteType enumeration values, indicating the AutoComplete behavior for the TextBox control. The default value is None.

ExceptionCondition
ArgumentOutOfRangeException

The selected value is not one of the System.Web.UI.WebControls.AutoCompleteType enumeration values.

To assist with data entry, Microsoft Internet Explorer 5 and later and some other browsers support a feature referred to as AutoComplete. AutoComplete monitors a text box and creates a list of values entered by the user. When the user returns to the text box at a later time, the list is displayed. Instead of retyping a previously entered value, the user can simply select the value from this list. Use the AutoCompleteType property to control the behavior of the AutoComplete feature for a TextBox control. The System.Web.UI.WebControls.AutoCompleteType enumeration is used to represent the values that you can apply to the AutoCompleteType property.

NoteNote

Not all browsers support the AutoComplete feature. Check with your browser to determine compatibility.

By default, the AutoCompleteType property for a TextBox control is set to AutoCompleteType.None. With this setting, the TextBox control shares the list with other TextBox controls with the same ID property across different pages. You can also share a list between TextBox controls based on a category, instead of an ID property. When you set the AutoCompleteType property to one of the category values (such as AutoCompleteType.FirstName, AutoCompleteType.LastName, and so on), all TextBox controls with the same category share the same list. You can disable the AutoComplete feature for a TextBox control by setting the AutoCompleteType property to AutoCompleteType.Disabled.

Refer to your browser documentation for details on configuring and enabling the AutoComplete feature. For example, to enable the AutoComplete feature in Internet Explorer version 5 or later, select Internet Options from the Tools menu, and then select the Content tab. Click the AutoComplete button to view and modify the various browser options for the AutoComplete feature.

For more information about the AutoComplete feature in Internet Explorer, see Using AutoComplete in HTML Forms in the MSDN Library.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

The following code example demonstrates how to use the AutoCompleteType enumeration to specify the AutoComplete category for a TextBox control.

Security noteSecurity Note

This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft