Textbox Control Code Samples

AutoComplete

This sample demonstrates how to use the AutoCompleteType property to specify the AutoComplete category for a Textbox control. The text box 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.

[ASP.NET] AutoCompleteType
<form id="form1" runat="server">
<h3>                  
    AutoCompleteType example</h3>
Enter values in the text boxes and click the Submit button.<br />
<br />
<!-- The following TextBox controls have different -->
<!-- categories assigned to their AutoCompleteType -->
<!-- properties. -->
<sq:TextBox ID="FirstNameTextBox" AutoCompleteType="FirstName" runat="server"
    Label="First Name:" /><br />
<sq:TextBox ID="LastNameTextBox" AutoCompleteType="LastName" runat="server"
    Label="Last Name:" /><br />
<sq:TextBox ID="EmailTextBox" AutoCompleteType="Email" runat="server" Label="Email:" /><br />
<!-- The following TextBox controls have the same -->
<!-- categories assigned to their AutoCompleteType -->
<!-- properties. They share the same AutoComplete -->
<!-- list. -->
<sq:TextBox ID="Phone1TextBox" AutoCompleteType="HomePhone" runat="server"
    Label="Phone Line #1:" /><br />
<sq:TextBox ID="Phone2TextBox" AutoCompleteType="HomePhone" runat="server"
    Label="Phone Line #2:" /><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. -->
<sq:TextBox ID="CategoryTextBox" AutoCompleteType="None" runat="server" Label="Category:" /><br />
<!-- The following TextBox control has the -->
<!-- AutoComplete feature disabled. -->
<sq:TextBox ID="CommentsTextBox" AutoCompleteType="Disabled" runat="server"
    Label="Comments:" /><br />
<br />
<br />
<sq:Button ID="SubmitButton" Text="Submit" runat="Server" /></form>