?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
TextBox 控件用于創(chuàng)建用戶可輸入文本的文本框。
屬性 | 描述 | .NET |
---|---|---|
AutoCompleteType | 規(guī)定 TextBox 控件的 AutoComplete 行為。 | 2.0 |
AutoPostBack | 布爾值,規(guī)定當(dāng)內(nèi)容改變時(shí),控件是否自動(dòng)回傳到服務(wù)器。默認(rèn)是 false。 | 1.0 |
CausesValidation | 規(guī)定當(dāng) Postback 發(fā)生時(shí),是否驗(yàn)證頁面。 | 2.0 |
Columns | textbox 的寬度。 | 1.0 |
MaxLength | 在 textbox 中所允許的最大字符數(shù)。 | 1.0 |
ReadOnly | 規(guī)定能否改變文本框中的文本。 | 1.0 |
Rows | textbox 的高度(僅在 TextMode="Multiline" 時(shí)使用)。 | 1.0 |
runat | 規(guī)定該控件是否是服務(wù)器控件。必須設(shè)置為 "server"。 | |
TagKey | ||
Text | textbox 的內(nèi)容。 | 1.0 |
TextMode | 規(guī)定 TextBox 的行為模式(單行、多行或密碼)。 | 1.0 |
ValidationGroup | 當(dāng) Postback 發(fā)生時(shí),被驗(yàn)證的控件組。 | |
Wrap | 布爾值,指示 textbox 的內(nèi)容是否換行。 | 1.0 |
OnTextChanged | 當(dāng) textbox 中的文本被更改時(shí),被執(zhí)行的函數(shù)的名稱。 |
AccessKey,?Attributes,?BackColor,?BorderColor,?BorderStyle,?BorderWidth,?CssClass,?Enabled,?Font,?EnableTheming,?ForeColor,?Height,?IsEnabled,?SkinID,?Style,?TabIndex,?ToolTip,?Width
AppRelativeTemplateSourceDirectory,?BindingContainer,?ClientID,?Controls,?EnableTheming,?EnableViewState,?ID,?NamingContainer,?Page,?Parent,?Site,?TemplateControl,?TemplateSourceDirectory,?UniqueID,?Visible
Textbox
<script??runat="server"> Sub?submit(sender?As?Object,?e?As?EventArgs) ???lbl1.Text="Your?name?is?"?&?txt1.Text End?Sub </script> <!DOCTYPE?html> <html> <body> <form?runat="server"> Enter?your?name: <asp:TextBox?id="txt1"?runat="server"?/> <asp:Button?OnClick="submit"?Text="Submit"?runat="server"?/> <p><asp:Label?id="lbl1"?runat="server"?/></p> </form> </body> </html>
在本例中,我們?cè)?.aspx 文件中聲明了一個(gè) TextBox 控件,一個(gè) Button 控件,和一個(gè) Label 控件。當(dāng)提交按鈕被觸發(fā)時(shí),會(huì)執(zhí)行 submit 子例程。這個(gè) submit 子例程會(huì)向 Label 控件輸出文本。
Textbox 2
<script??runat="server"> sub?submit(sender?As?Object,?e?As?EventArgs) lbl1.Text=txt1.Text end?sub </script> <!DOCTYPE?html> <html> <body> <form?runat="server"> <asp:TextBox?id="txt1"?Text="Hello?World!" Font_Face="verdana"?BackColor="#0000ff" ForeColor="white"?TextMode="MultiLine" Height="50"?runat="server"?/> <asp:Button?OnClick="submit" Text="Copy?Text?to?Label"?runat="server"?/> <p><asp:Label?id="lbl1"?runat="server"?/></p> </form> </body> </html>
在本例中,我們?cè)?.aspx 文件中聲明了一個(gè) TextBox 控件,一個(gè) Button 控件,和一個(gè) Label 控件。當(dāng)提交按鈕被觸發(fā)時(shí),會(huì)執(zhí)行 submit 子例程。這個(gè) submit 子例程會(huì)把文本框的內(nèi)容拷貝到 Label 控件。