Net Getting Started Tutorial: ASP. NET Button control

Source: Internet
Author: User

ASP. NET Button control

The Button control is used to display a Button.


Button control
The Button control is used to display a Button. This button may be a submit button or command button. According to the preset, this control is a submit button.

When a web page with the submit button without command name or position is returned to the server, click. The commit button may be pressed when an event handler is written to control the action.

The command name of a command button and allow you to create multiple button controls on the page. The command button may be pressed when you write an event handler to control the action.

The network control reference page lists the properties and properties of the Button control.

The following example shows a simple button control:

<Html> <body> <form runat = "server"> <asp: Button id = "b1" Text = "Submit" runat = "server"/> </form>
</Body> 
   

Add script
Click the button most frequently when submitting a form.

In the following example, we declare a TextBox control, a Button control, and a Label control.

Aspx file. When the submit button is triggered, submit the subprogram for execution. Submit the sub-program to write a text label control:

<Script runat = "server"> Sub submit (sender As Object, e As EventArgs) lbl1.Text = "Your name is" & txt1.TextEnd Sub </script>
<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> 
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.