获取或设置一个值,该值指示 TextBox 控件的 AutoComplete 行为
命名空间: System.Web.UI.WebControls
程序集: System.Web(在 System.Web.dll 中)
语法
<!---->
<ThemeableAttribute(False)> _
Public Overridable Property AutoCompleteType As AutoCompleteType
Dim instance As TextBox
Dim value As AutoCompleteType
value = instance.AutoCompleteType
instance.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 () : AutoCompleteType
public function set AutoCompleteType (value : AutoCompleteType)
<asp:TextBox AutoCompleteType="AutoCompleteType" />
异常
备注
<!---->
为协助完成数据输入,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>
分享到:
相关推荐
#angular-textbox.io ##这是做什么的? ###tl;dr angular-textbox.io提供了一个 AngularJS 指令,允许 Textbox.io 所见即所得的富文本编辑器成为您的<form> 。 ##要求 AngularJS 1.3 * Textbox.io 1.2+ ...
精彩编程与编程技巧-自动卷动TextBox ...
不要打开记事本应用程序或代码编辑器,而是转到 textbox.page 并将其粘贴到那里。 它有代码模式和写作模式。 代码模式支持 Tab 键。 如果你愿意贡献,我会很高兴的! 将其保存在一个文件(index.html)中,没有...
精彩编程与编程技巧-如何做出跑馬燈效果的 TextBox ...
vb读取txt文件到textbox.doc
This demonstrates how to create an auto-scrolling textbox.
肯定不少朋友一看就会觉得再容易不过了:给TextBox添加GotFocus事件,然后在事件中调用TextBox.SelectAll()不就完事了吗?巢皮一开始也理所当然得这么认为,但要是你试试这么做,你会发现的当你用点击鼠标左键让...
if (textbox.TextLength == 0) { errorProvider1.SetError(textbox, "请输入" + controlName + "内容!"); textbox.SelectAll(); textbox.Focus(); } else if (textbox.TextLength > length) { ...
jqxnumberinput.js: NumberInput TextBox widget jqxinput.js: TextBox widget jqxpanel.js: Panel widget jqxpopup.js: impements PopUp widget jqxprogressbar.js: ProgressBar widget jqxpasswordinput.js: ...
VB api编程模块TextBox密码控件代码VB api password TextBox control code programming model
Programming with Microsoft® Visual Basic® .NET (Prerelease) iii Contents Introduction Course Materials.......................................................................................
Contents Introduction Course Materials.........................................................................................2 Prerequisites........................................................
Contents Introduction Course Materials..................................................................................................2 Prerequisites.................................................
一个TextBox组件,Powerful
Contents Introduction Course Materials......................................................................................................2 Prerequisites...........................................
7.3.3 TextBox控件的其他特征 172 7.3.4 PasswordBox控件 173 7.4 列表控件 174 7.4.1 ListBox控件 174 7.4.2 ComboBox控件 177 7.5 基于范围的控件 178 7.5.1 Slider控件 178 7.5.2 进度条 179 7.6 结束语 180 第8...
sum = sum + Convert.ToDouble(textBox.Text); if(flag==1) sum = sum - Convert.ToDouble(textBox.Text); if(flag==2) sum = sum * Convert.ToDouble(textBox.Text); if(flag==3) sum = sum / Convert.To...
本程序为c#程序,用来导入excel数据到你想要的textbox中。