Use Cases to learn about. net WebForms (1)

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.