TextBox:
TextBox is the input control in asp.net. It has three forms: <input type = text>, <input type = password>, and <TextArea>
In asp.net, the TextBox Definition Format is
<Asp: TextBox runat = server id = "text1" Text = "Tofu technology station" ....../>
Code definition method
<Script language = "C #" runat = server>
Void AddText (){
TextBox text1 = new TextBox ();
Text1.Text = "Tofu technology station ";
......
}
</Script>
The above is a brief introduction to TextBox. The following describes some of the main attributes of TextBox and their usage methods in detail.
AccessKey, which enables the TextBox to get the focus on the page through ALT + [specified key]: for example:
<Asp: TextBox id = "TextBox1" Text = "Tofu http://www.asp888.net" runat = "server"/>
Or:
TextBox1.AccessKey = "Y ";
Attributes: assign values to the properties of the TextBox control, for example:
TextBox1.Attributes ["maxlength"] = "20"; through Attributes, you can easily determine some
Easy assignment
TextMode is a very important attribute in TextBox. We need to use it to determine the type of our current input.
His three assignment values
TextBox1.TextMode = TextBoxMode. SingleLine; // single line input box
TextBox1.TextMode = TextBoxMode. MultiLine; // multi-line input box
TextBox1.TextMode = TextBoxMode. Password; // Password input box
Text is the attribute of the data in the input box of TextBox. It is readable and writable.
In addition, there are some control attributes for the appearance attributes of TextBox, such as Font, ToolTip, etc., because basically there is no need for programming
So it is not explained in detail here
Label is the control that we use to display the output in Asp. Net. We still have two ways to define this space.
<Asp: Label runat = server id = "label" Text = "Tofu technology station" ....../>
Code definition method
<Script language = "C #" runat = server>
Void AddText (){
Label label1 = new Label ();
Label. Text = "Tofu technology station ";
......
}
</Script>
Among them, the most common attribute is Text.