ASPX. Net Control,

Source: Internet
Author: User

ASPX. Net Control,

Simple controls

Label: displays text. After compilation, the elements are span. The main settings include border color, border style, and Border width.

Liteal: displays text. It does not produce any elements after compilation. It is generally used to output JS code from the background.

Textbox: text input box

Attribute:

TextMode (style) includes SingleLine (single-line text box), MultiLine (multi-line text box), Password (Password box), Color, Date, DtaeTime ···

AutoPostBack

Gets or sets a value that indicates whether or not to automatically send the data back to the server whenever you press the Enter or Tab key in the TextBox Control.
CausesValidation
Gets or sets a value that indicates whether to perform verification when the TextBox Control is set to perform verification when sending back.
ID
Control ID
Text
Control text to be displayed
TextMode
Gets or sets the behavior mode of the TextBox Control (single line, multiple lines, or password)
Width
Widget width
Visible
Visible or not
ReadOnly
Gets or sets a value to indicate whether the content of the TextBox control can be read-only.
CssClass
Widget rendering Style
BackColor
Control background color
Enabled
Control availability MaxLength Maximum length (number of characters entered)
Most of the attributes of the TextBox Control are set similarly to those of the Label control.
The TextMode attribute is mainly used to control the text display mode of the TextBox Control. The setting options of this attribute are as follows.
L SingleLine: You can only enter information in one row, and you can also select to limit the number of characters received by the control.
L MultiLine: when the text is long, you can enter multiple lines of text and execute line breaks.
L Password: Use a black dot (●) to hide the characters entered by the user.
For example, when verifying a user's logon Password, you can set the TextMode attribute of the TextBox Control to Password. There may be a lot of text when entering the remarks, in this case, you can set the TextMode attribute of the TextBox Control to MultiLine.
  After the Button is compiled, it is submit.
OnClick is the server-side event of the button.
OnClientClick is the client event of the button. The client takes precedence over the server. When you click the button on the client, the JS is executed before submission.
Generally, we use OnClientClick to verify the submitted data, but this must return true or false, that is, we must add return, otherwise the OnClick is invalid. When false is returned, The OnClick server event is aborted. If your js verification has an error, the server event OnClientClick is also skipped. To avoid such errors, you can use server-side verification to save the OnClientClick event, so you do not need to consider conflicts with OnClick. However, in terms of performance, server verification consumes server resources.Create a folder in the ImageButton image button, drag the image into the class created by using the database connection method of the ImageURL LinkButton button WebForm and put it in the App_Code folder without a namespace. 12 form elements

Text:
Text
Password
Textarea
Hidden

Button class:
Button
Submit
Reset
Image

Select class:
Radio
Checkbox
File
Select option

Stateless http:
Every time an event is submitted, the page will be refreshed, And the refresh will go through the Load event. Refresh will repeat the binding.
Determine whether the page is loaded for the first time or whether a button in the loaded page is submitted and returned.  If (! IsPostBack) 95% of the load Event code should be written here


Composite Control:
DropDownList

Will be compiled as select option

Ps. name is commonly used on the server and id Client

1. Put data in
1. DataSource
DropDownList1.DataSource = new NationData (). Select (); // data source binding
DropDownList1.DataTextField = "NationName"; // bind the display field
DropDownList1.DataValueField = "NationCode"; // hide the field and bind it to DropDownList1.DataBind ();
2. Foreach
 List<Nation> Nlist = new NationData().Select();           foreach (Nation n in Nlist)            {                 ListItem li = new ListItem(n.NationName, n.NationCode);               if (li.Value == "N003")                 {                     li.Selected = true;                 }                DropDownList1.Items.Add(li);
}
2. extract data
1. Read a piece of data
 

Value or Select can be obtained as needed

It can be directly clicked out to create a string-type data reception

2,

Because DropDownList can only be selected, multiple data entries cannot be retrieved.

Multiple widgets can retrieve multiple pieces of data, such as ListBox

The method for adding data to ListBox is the same as that of DropDownList,You can change the SelectionMode attribute to multiple or one choice.

Select Multiple when SelectionMode = "Multiple"Select when SelectionMode = "Single"

ValueString end = "";

Foreach (ListItem li in ListBox1.Items)

{If (li. Selected) {end + = li. Text + "-" + li. Value + "," ;}} Label1.Text = end;


RadioButtonListCheckBoxList multiple-choice list

 

 

Related Article

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.